-
Notifications
You must be signed in to change notification settings - Fork 114
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
Error loading server extension jupyros ImportError: Error importing numpy: #170
Comments
Finally I sorted out the problem by comparing PYTHONPATH between ros_noetic and ros_humble. It seems that the jupyros extension loaded some sort of precedent to the numpy=2.0.1 package installed with it while the PYTHONPATH of ros_humble point to numpy=1.26.4 and lead to the DLL load failure. I installed numpy=2.0.1 in the ros_humble env and it works. Down the road another offending package is PIL/pillow, I applied the same trick but I got other problems with PIL in Jupyter. By pure fluke I managed to get it done by deleting ros_humble's pillow package while copying the PIL library from jupyros to the PYTHONPATH of ros_humble. I just wonder are these just asynchronous in development between jupyros and ros_desktop or I did miss something? How the precedent arise in the jupyter extension if there is really any such precedent? I did try to install jupyros in the same ros_humble env but you still got the same PIL/pillow problem to solve. What would be other successful Windows installations of current distribution of RoboStack out there? |
Sorry, which kind of PIL/pillow issue you are having? Thanks! |
Do you mix conda channels or pip and conda any chance? |
I'm referring to the same problem of replacing pillow=10.3.0 in ros_humble with pillow=10.4.0 in jupyros if you install jupyros after ros_humble_desktop. I don't have the setup to reproduce the problems but I can illustrate with the correct ones This display would be magnified at least 3 - 4 times. The Start Stop widgets buttons not running due to some javascript problems. There are some other issues to run the ipynb in notebook. |
jupyros was installed by pip install --pre jupyros==0.7.0a0 according to #157 in the base env ros_humble_desktop are installed strictly by the Getting Started manual. What would be other valid combinations? |
Solution to issue cannot be found in the documentation.
Issue
I'm not sure if it is a bug, my platform is a portable version of Miniconda3 py311 on Win10, I have no problem to launch ros_noetic but ros_humble seems to be a very different species.
The jupyros extension is installed in the base env, the extension loaded as expected in the base as well as in ros_noetic but got errors below in ros_humble.
I tried the fix from https://stackoverflow.com/questions/61663400/dll-load-failed-multiarray-unmath-when-importing-numpy with
set PATH=%PATH%;K:\Miniconda3\py311\Library\bin
but no help!
What did I miss? What is the correct version of numpy or Visual C++ Redistributable should be used?
[W 15:55:54.850 NotebookApp] Error loading server extension jupyros
Traceback (most recent call last):
File "K:\Miniconda3\py311\envs\ros_humble\Lib\site-packages\numpy\core_init_.py", line 24, in
from . import multiarray
File "K:\Miniconda3\py311\envs\ros_humble\Lib\site-packages\numpy\core\multiarray.py", line 10, in
from . import overrides
File "K:\Miniconda3\py311\envs\ros_humble\Lib\site-packages\numpy\core\overrides.py", line 8, in
from numpy.core._multiarray_umath import (
ImportError: DLL load failed while importing _multiarray_umath: The specified module could not be found.
Errors from import jupyros.ros2
ImportError Traceback (most recent call last)
File K:\Miniconda3\py311\envs\ros_humble\Lib\site-packages\numpy\core_init_.py:24
23 try:
---> 24 from . import multiarray
25 except ImportError as exc:
File K:\Miniconda3\py311\envs\ros_humble\Lib\site-packages\numpy\core\multiarray.py:10
9 import functools
---> 10 from . import overrides
11 from . import _multiarray_umath
File K:\Miniconda3\py311\envs\ros_humble\Lib\site-packages\numpy\core\overrides.py:8
7 from .._utils._inspect import getargspec
----> 8 from numpy.core._multiarray_umath import (
9 add_docstring, _get_implementing_args, _ArrayFunctionDispatcher)
12 ARRAY_FUNCTIONS = set()
ImportError: DLL load failed while importing _multiarray_umath: The specified module could not be found.
During handling of the above exception, another exception occurred:
ImportError Traceback (most recent call last)
File K:\Miniconda3\py311\envs\ros_humble\Lib\site-packages\numpy_init_.py:130
129 try:
--> 130 from numpy.config import show as show_config
131 except ImportError as e:
File K:\Miniconda3\py311\envs\ros_humble\Lib\site-packages\numpy_config_.py:4
3 from enum import Enum
----> 4 from numpy.core._multiarray_umath import (
5 cpu_features,
6 cpu_baseline,
7 cpu_dispatch,
8 )
10 all = ["show"]
File K:\Miniconda3\py311\envs\ros_humble\Lib\site-packages\numpy\core_init_.py:50
27 msg = """
28
29 IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
(...)
48 """ % (sys.version_info[0], sys.version_info[1], sys.executable,
49 version, exc)
---> 50 raise ImportError(msg)
51 finally:
ImportError:
IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.
We have compiled some common reasons and troubleshooting tips at:
Please note and check the following:
and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.
Original error was: DLL load failed while importing _multiarray_umath: The specified module could not be found.
The above exception was the direct cause of the following exception:
ImportError Traceback (most recent call last)
Cell In[4], line 2
1 import rclpy as rp
----> 2 import jupyros.ros2
File K:\Miniconda3\py311\Lib\site-packages\jupyros_init_.py:24
19 ros_distro = 'noetic'
21 if ros_version == '2':
22 # Import ROS2 modules
23 # print(f'ROS2 {ros_distro} environment detected.')
---> 24 from .ros2.publisher import *
25 from .ros2.ros_widgets import *
26 from .ros2.subscriber import *
File K:\Miniconda3\py311\Lib\site-packages\jupyros\ros2_init_.py:16
9 from .._version import version
11 #from ..ros1.ipy import *
12 #from ..ros1.ros3d import *
13 #from ..ros1.server_extension import *
14 #from ..ros1.turtle_sim import *
---> 16 from ..ros2.publisher import *
17 from ..ros2.ros_widgets import *
18 from ..ros2.subscriber import *
File K:\Miniconda3\py311\Lib\site-packages\jupyros\ros2\publisher.py:23
21 import time
22 import ipywidgets as widgets
---> 23 from .ros_widgets import add_widgets, rsetattr, rgetattr
24 import functools
29 try:
File K:\Miniconda3\py311\Lib\site-packages\jupyros\ros2\ros_widgets.py:1
----> 1 import rosidl_runtime_py.utilities as rut
2 import ipywidgets as widgets
3 from ament_index_python.packages import get_package_share_directory
File K:\Miniconda3\py311\envs\ros_humble\Lib\site-packages\rosidl_runtime_py_init_.py:15
1 # Copyright 2019 Open Source Robotics Foundation, Inc.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
(...)
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
---> 15 from .convert import get_message_slot_types
16 from .convert import message_to_csv
17 from .convert import message_to_ordereddict
File K:\Miniconda3\py311\envs\ros_humble\Lib\site-packages\rosidl_runtime_py\convert.py:20
17 import sys
18 from typing import Any
---> 20 import numpy
21 import rosidl_parser.definition
22 import yaml
File K:\Miniconda3\py311\envs\ros_humble\Lib\site-packages\numpy_init_.py:135
131 except ImportError as e:
132 msg = """Error importing numpy: you should not try to import numpy from
133 its source directory; please exit the numpy source tree, and relaunch
134 your python interpreter from there."""
--> 135 raise ImportError(msg) from e
137 all = [
138 'exceptions', 'ModuleDeprecationWarning', 'VisibleDeprecationWarning',
139 'ComplexWarning', 'TooHardError', 'AxisError']
141 # mapping of {name: (value, deprecation_msg)}
ImportError: Error importing numpy: you should not try to import numpy from
its source directory; please exit the numpy source tree, and relaunch
your python interpreter from there.
Installed packages
Environment info
The text was updated successfully, but these errors were encountered: