Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[🐛 BUG] Problem of intercompability between environment Docker/Un*x and Windows for path #2261

Closed
4 of 7 tasks
FlorianJacta opened this issue Nov 19, 2024 · 9 comments · Fixed by #2267
Closed
4 of 7 tasks
Labels
Core: Data node Core Related to Taipy Core 💥Malfunction Addresses an identified problem. 🟨 Priority: Medium Not blocking but should be addressed 🔒 Staff only Can only be assigned to the Taipy R&D team

Comments

@FlorianJacta
Copy link
Member

FlorianJacta commented Nov 19, 2024

What went wrong? 🤔

First, create a storage folder, ".taipy", built when running Taipy with Windows.
Then, try to run your code in a Linux-based Docker with this ".taipy".

This will create an issue for File Based Datanodes.

Traceback (most recent call last):
  File "/app/main.py", line 20, in <module>
    print(scenario.data.read())
          ^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/taipy/core/data/data_node.py", line 411, in read
    return self.read_or_raise()
           ^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/taipy/core/data/data_node.py", line 402, in read_or_raise 
    return self._read()
           ^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/taipy/core/data/pickle.py", line 99, in _read
    return self._read_from_path()
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/taipy/core/data/pickle.py", line 105, in _read_from_path  
    with open(path, "rb") as pf:
         ^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: 'user_data\\pickles\\DATANODE_data_dec56298-e438-4fcd-a1d9-313ad7bfa33e.p'

Expected Behavior

This should work on all supported versions of Taipy.

How to reproduce

Dockerfile

# Copyright 2021-2024 Avaiga Private Limited
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
#        http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
# an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
# specific language governing permissions and limitations under the License.

FROM python:3.11

WORKDIR /app

# Install application dependencies.
COPY src/requirements.txt .
RUN pip install -r requirements.txt

# Copy the application source code.
COPY src .

CMD ["taipy", "run", "--no-debug", "--no-reloader", "main.py", "--host", "0.0.0.0", "-P", "5000", "--experiment", "1", "--force"]

src/requirements.txt

taipy==4.0.1

src/main.py

import taipy as tp
from taipy import Config, Scope

data_cfg = Config.configure_data_node(
    id="data", storage_type="pickle", scope=Scope.GLOBAL, default_data=1
)

scenario_cfg = Config.configure_scenario(
    id="scenario",
    additional_data_node_configs=[data_cfg],
)

if __name__ == "__main__":
    tp.Orchestrator().run()
    scenarios = tp.get_scenarios()
    if len(scenarios) == 0:
        scenario = tp.create_scenario(scenario_cfg)
    else:
        scenario = scenarios[0]
    print(scenario.data.read())

Go into src and run the main.py locally (Windows) with :

taipy run main.py --experiment 1 --force

This will create the .taipy and user_data folders inside of src.

Then, go in the root folder and build and run the docker:

docker build -t issue2261 .
docker run -it -p 5000:5000issue2261

Here is the error raised:

(dev) PS C:\Users\jacta\OneDrive\Bureau\taipy\Code\basic-demo> docker run -it -p 5000:5000 issue
[2024-11-21 09:02:51.005][Taipy][INFO] Updating configuration with command-line arguments...
[2024-11-21 09:02:51.005][Taipy][INFO] Managing application's version...
[2024-11-21 09:02:51.014][Taipy][INFO] Checking application's version...
[2024-11-21 09:02:51.015][Taipy][WARNING] tasks field of ScenarioConfig `scenario` is empty.
[2024-11-21 09:02:51.015][Taipy][INFO] Blocking configuration update...
[2024-11-21 09:02:51.015][Taipy][INFO] Starting job dispatcher...
[2024-11-21 09:02:51.016][Taipy][INFO] Orchestrator service has been started.
Traceback (most recent call last):
  File "/app/main.py", line 20, in <module>
    print(scenario.data.read())
          ^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/taipy/core/data/data_node.py", line 411, in read
    return self.read_or_raise()
           ^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/taipy/core/data/data_node.py", line 402, in read_or_raise 
    return self._read()
           ^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/taipy/core/data/pickle.py", line 99, in _read
    return self._read_from_path()
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/taipy/core/data/pickle.py", line 105, in _read_from_path  
    with open(path, "rb") as pf:
         ^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: 'user_data\\pickles\\DATANODE_data_dec56298-e438-4fcd-a1d9-313ad7bfa33e.p'

Version of Taipy

4.0.1

Acceptance Criteria

  • A unit test reproducing the bug is added.
  • Any new code is covered by a unit tested.
  • Check code coverage is at least 90%.
  • The bug reporter validated the fix.
  • Related issue(s) in taipy-doc are created for documentation and Release Notes are updated.

Code of Conduct

  • I have checked the existing issues.
  • I am willing to work on this issue (optional)
@FlorianJacta FlorianJacta added Core Related to Taipy Core 💥Malfunction Addresses an identified problem. 🟨 Priority: Medium Not blocking but should be addressed labels Nov 19, 2024
@jrobinAV
Copy link
Member

The data nodes inheriting from _FileDataNodeMixin are using the path property as a string. It should be protected using a pathlib.Path.

@jrobinAV jrobinAV added 🟧 Priority: High Must be addressed as soon Core: Data node 🟨 Priority: Medium Not blocking but should be addressed 🔒 Staff only Can only be assigned to the Taipy R&D team and removed 🟨 Priority: Medium Not blocking but should be addressed 🟧 Priority: High Must be addressed as soon labels Nov 19, 2024
@joaoandre-avaiga
Copy link
Collaborator

@FlorianJacta is the problem with the path to the csv file? I.E. you try to read the datanode and it can't because it can't find the file? Can you provide the example to test the issue?

@FlorianJacta
Copy link
Member Author

@joaoandre-avaiga @jrobinAV I have updated the description!

@joaoandre-avaiga
Copy link
Collaborator

Thank you! I will be submiting a PR with the fix today.

@FabienLelaquais FabienLelaquais changed the title [🐛 BUG] Problem of intercompability between environment Docker/Linus and Windows for path [🐛 BUG] Problem of intercompability between environment Docker/Un*x and Windows for path Dec 2, 2024
@FlorianJacta
Copy link
Member Author

I am unable to test the fix as I get an error when I try to install 4.0.2.dev0

(base) (src) PS C:\Users\jacta\OneDrive\Bureau\taipy\Code\test_402dev0\src> uv pip install taipy==4.0.2.dev0
  × No solution found when resolving dependencies:
  ╰─▶ Because there is no version of taipy-gui==4.0.2.dev0 and taipy==4.0.2.dev0 depends on taipy-gui==4.0.2.dev0, we can    
      conclude that taipy==4.0.2.dev0 cannot be used.
      And because you require taipy==4.0.2.dev0, we can conclude that your requirements are unsatisfiable.

      hint: taipy-gui was requested with a pre-release marker (e.g., taipy-gui==4.0.2.dev0), but pre-releases weren't        
      enabled (try: `--prerelease=allow`)

@joaoandre-avaiga
Copy link
Collaborator

When using uv you have to add --prerelease=allow when installing a package that might have prerelease dependencies, otherwise it will try to find the required versions only in officially release packages.

@FlorianJacta
Copy link
Member Author

Tested with 4.0.2.dev0 and had no issues

@jrobinAV
Copy link
Member

jrobinAV commented Dec 9, 2024

All right! Super. So, we can backport it into 4.0 release branch.

@AlexandreSajus
Copy link
Contributor

Fixed in 4.0.2.dev2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Core: Data node Core Related to Taipy Core 💥Malfunction Addresses an identified problem. 🟨 Priority: Medium Not blocking but should be addressed 🔒 Staff only Can only be assigned to the Taipy R&D team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants