figoyouwei / taipy_success

This is a sample code that tests the deployment on heroku
2 stars 0 forks source link

Enterprise ImportError #6

Open figoyouwei opened 3 weeks ago

figoyouwei commented 3 weeks ago

Hi,

I was running this same script, v3.1.0 is fine https://github.com/figoyouwei/taipy_success/blob/main/scenarios/job_execution.py

but the newly installed enterprise version returns this error ImportError: bad magic number in 'taipy.enterprise': b'o\r\r\n'

FlorianJacta commented 2 weeks ago

Hi,

Could you give us how you installed Enterprise, how you run it, and this information?

figoyouwei commented 2 weeks ago

sw_vers

ProductName: macOS ProductVersion: 14.2.1 BuildVersion: 23C71

python --version

Python 3.12.3

poetry --version

Poetry (version 1.8.2)

FlorianJacta commented 2 weeks ago

Thank you! Could you try using a 3.11 Python version and tell me if it changes anything? We are working on it right now.

figoyouwei commented 2 weeks ago

Oh, the basic job run works with 3.11.4, I will play with scheduling later.

figoyouwei commented 2 weeks ago

On Python 3.11.4

import taipy as tp It still returns this error, strange...

ImportError: bad magic number in 'taipy.enterprise': b'o\r\r\n'

FlorianJacta commented 2 weeks ago

What has changed from your initial run?

Taipy Enterprise, when installed, is specific to the Python version you installed it with.

figoyouwei commented 2 weeks ago

I think previously I was not running taipy Enterprise, you know vscode has kinda mistaken me. Today I installed and directly test the import taipy as tp from the terminal.

FlorianJacta commented 2 weeks ago

What do you use as a virtual environment?

If you have conda, do:

conda create -n enterprise python=3.11
conda activate enterprise
pip install "<the enterprise token here>"

Then, this should work:

python
import taipy
figoyouwei commented 2 weeks ago

I am using poetry.

FlorianJacta commented 2 weeks ago

I am also using poetry sometimes. This shouldn't be an issue. Taipy Enterprise version can be run only with the Python version that has been installed.

You could try to install it again by creating a new environment and installing with a particular version of Python in your pyproject.toml.

AlexandreSajus commented 2 weeks ago

Could we get the full logs when you get this error? We'll send this to R&D to take a look

figoyouwei commented 2 weeks ago

this is my mac

Screenshot 2024-08-29 at 21 11 38
figoyouwei commented 2 weeks ago

python is installed via pyenv pyenv install 3.11.4

figoyouwei commented 2 weeks ago

(scheduler-py3.11) bash-3.2$ python Python 3.11.4 (main, Aug 10 2023, 14:26:31) [Clang 14.0.3 (clang-1403.0.22.14.1)] on darwin Type "help", "copyright", "credits" or "license" for more information.

import taipy as tp Traceback (most recent call last): File "", line 1, in File "/Users/youweizheng/GitHub/newdev/taipyio/taipy_success/scheduler/.venv/lib/python3.11/site-packages/taipy/init.py", line 22, in from taipy.core._init import File "/Users/youweizheng/GitHub/newdev/taipyio/taipy_success/scheduler/.venv/lib/python3.11/site-packages/taipy/core/init.py", line 41, in from ._init import File "/Users/youweizheng/GitHub/newdev/taipyio/taipy_success/scheduler/.venv/lib/python3.11/site-packages/taipy/core/_init.py", line 12, in from ._core import Core File "/Users/youweizheng/GitHub/newdev/taipyio/taipy_success/scheduler/.venv/lib/python3.11/site-packages/taipy/core/_core.py", line 20, in from ._orchestrator._dispatcher._job_dispatcher import _JobDispatcher File "/Users/youweizheng/GitHub/newdev/taipyio/taipy_success/scheduler/.venv/lib/python3.11/site-packages/taipy/core/_orchestrator/_dispatcher/init.py", line 12, in from ._development_job_dispatcher import _DevelopmentJobDispatcher File "/Users/youweizheng/GitHub/newdev/taipyio/taipy_success/scheduler/.venv/lib/python3.11/site-packages/taipy/core/_orchestrator/_dispatcher/_development_job_dispatcher.py", line 16, in from ._job_dispatcher import _JobDispatcher File "/Users/youweizheng/GitHub/newdev/taipyio/taipy_success/scheduler/.venv/lib/python3.11/site-packages/taipy/core/_orchestrator/_dispatcher/_job_dispatcher.py", line 21, in from ...data._data_manager_factory import _DataManagerFactory File "/Users/youweizheng/GitHub/newdev/taipyio/taipy_success/scheduler/.venv/lib/python3.11/site-packages/taipy/core/data/_data_manager_factory.py", line 17, in from ._data_manager import _DataManager File "/Users/youweizheng/GitHub/newdev/taipyio/taipy_success/scheduler/.venv/lib/python3.11/site-packages/taipy/core/data/_data_manager.py", line 21, in from .._version._version_mixin import _VersionMixin File "/Users/youweizheng/GitHub/newdev/taipyio/taipy_success/scheduler/.venv/lib/python3.11/site-packages/taipy/core/_version/_version_mixin.py", line 17, in class _VersionMixin: File "/Users/youweizheng/GitHub/newdev/taipyio/taipy_success/scheduler/.venv/lib/python3.11/site-packages/taipy/core/_version/_version_mixin.py", line 19, in _VersionMixin _version_manager = _VersionManagerFactory._build_manager() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/youweizheng/GitHub/newdev/taipyio/taipy_success/scheduler/.venv/lib/python3.11/site-packages/taipy/core/_version/_version_manager_factory.py", line 26, in _build_manager version_manager = _utils._load_fct( ^^^^^^^^^^^^^^^^^ File "/Users/youweizheng/GitHub/newdev/taipyio/taipy_success/scheduler/.venv/lib/python3.11/site-packages/taipy/core/common/_utils.py", line 24, in _load_fct module = import_module(module_name) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/youweizheng/.pyenv/versions/3.11.4/lib/python3.11/importlib/init.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ImportError: bad magic number in 'taipy.enterprise': b'o\r\r\n'

figoyouwei commented 1 week ago

When this week, can we try this again on my MacOS? Of course, I plan also to try this in some Linux machine and give you feedbacks later in parallel, but Mac has to work...

FlorianJacta commented 1 week ago

We'll try again after R&D finishes their work on the subject. They are working on it. I'll give you an update tomorrow and we could move from there. Your issue is not reproduced by Mac users or Windows users when using Python 3.11.4; this might come from Poetry.

If this is a real issue, we could use our usual way to install Taipy Enterprise (conda, venv, ..) as we don't know how Poetry installs packages.

FlorianJacta commented 1 week ago

We have reproduced and investigated the issue. This is indeed an issue on Poetry side. You can solve it using the same Python version in your project as your base Python environment.

Taipy Enterprise now works fine with Python 3.12.

figoyouwei commented 1 week ago

So what's next? I don't use Poetry and try to move on with pip?

FlorianJacta commented 1 week ago

We have sometimes made it work with Poetry, but Poetry doesn't manage Python versions, which creates issues.

I advise using normal pip in a conda env, venv, or any other virtual environment. If you have any issues, let's have a call together to finally fix this.

figoyouwei commented 6 days ago

I am using pyenv to manage Python version, and Poetry for packages. I don't use pip anymore. I mean I could try pip to make test run, but for the long term, poetry has to work...