marinlauber / Python-VPP

3-DOF Velocity Prediction Program
MIT License
44 stars 26 forks source link

https://yacht-vpp.streamlit.app/ throws import error #34

Closed MG-ng closed 2 months ago

MG-ng commented 3 months ago

Hello, I think the idea of a hosted site is very cool. However, I've got the following error when using your streamlit site:

Bildschirmfoto 2024-06-28 um 20 17 16

marinlauber commented 3 months ago

Hi @MG-ng,

This one, I am afraid only @TAJD can help you with. Maybe could you copy the full error message here that would help?

TAJD commented 3 months ago

Thank you for reporting this error! I'll take a look when I'm able.

To confirm: you saw this error when you logged in is that correct? Did you do anything else I might need to replicate.

biffyw commented 2 months ago

The full traceback below...the solution is to set the version of numpy explicitly to 1.x, ie:

numpy==1.26
(venv) biff@DELL7050-1:~/projects/Python-VPP-master$ python runVPP.py
INFO:matplotlib.font_manager:generated new fontManager

A module that was compiled using NumPy 1.x cannot be run in
NumPy 2.0.0 as it may crash. To support both 1.x and 2.x
versions of NumPy, modules must be compiled with NumPy 2.0.
Some module may need to rebuild instead e.g. with 'pybind11>=2.12'.

If you are a user of the module, the easiest solution will be to
downgrade to 'numpy<2' or try to upgrade the affected module.
We expect that some modules will need time to support NumPy 2.

Traceback (most recent call last):  File "/home/biff/projects/Python-VPP-master/runVPP.py", line 10, in <module>
    from src.VPPMod import VPP
  File "/home/biff/projects/Python-VPP-master/src/VPPMod.py", line 13, in <module>
    import nlopt
  File "/home/biff/projects/Python-VPP-master/venv/lib/python3.9/site-packages/nlopt/__init__.py", line 1, in <module>
    from .nlopt import *
  File "/home/biff/projects/Python-VPP-master/venv/lib/python3.9/site-packages/nlopt/nlopt.py", line 20, in <module>
    from . import _nlopt
AttributeError: _ARRAY_API not found
Traceback (most recent call last):
  File "/home/biff/projects/Python-VPP-master/runVPP.py", line 10, in <module>
    from src.VPPMod import VPP
  File "/home/biff/projects/Python-VPP-master/src/VPPMod.py", line 13, in <module>
    import nlopt
  File "/home/biff/projects/Python-VPP-master/venv/lib/python3.9/site-packages/nlopt/__init__.py", line 1, in <module>
    from .nlopt import *
  File "/home/biff/projects/Python-VPP-master/venv/lib/python3.9/site-packages/nlopt/nlopt.py", line 20, in <module>
    from . import _nlopt
ImportError: numpy.core.multiarray failed to import
MG-ng commented 2 months ago

Thank you very much for your suggested fix @biffyw

@TAJD All I did was making 2 clicks: The first in the README on the linked website (https://yacht-vpp.streamlit.app) and the second on the left side on "VPP ⛵"

@marinlauber Here's the full text, but you can probably see more like @biffyw has already written:

File "/home/adminuser/venv/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 589, in _run_script
    exec(code, module.__dict__)
File "/mount/src/python-vpp/demos/pages/1_VPP_⛵.py", line 13, in <module>
    from src.api import app
File "/mount/src/python-vpp/src/api.py", line 15, in <module>
    from src.VPPMod import VPP
File "/mount/src/python-vpp/src/VPPMod.py", line 13, in <module>
    import nlopt
File "/home/adminuser/venv/lib/python3.9/site-packages/nlopt/__init__.py", line 1, in <module>
    from .nlopt import *
File "/home/adminuser/venv/lib/python3.9/site-packages/nlopt/nlopt.py", line 20, in <module>
    from . import _nlopt
TAJD commented 2 months ago

Thank you very much for reporting this error! I think I've fixed it by setting dependencies. Once the PR is in I'll close this issue.

TAJD commented 2 months ago

Ok have switched the web app to a live functional version so will close this issue.