Closed an99990 closed 3 years ago
It seems you have various versions of python. Did you use python3.6 to run the example.py? There is a warning in your installation
You are attempting to install a package to a directory that is not
on PYTHONPATH and which Python does not read ".pth" files from. The
installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:
/home/halodi/.local/lib/python3.6/site-packages/
and your PYTHONPATH environment variable currently contains:
'/opt/ros/foxy/lib/python3.8/site-packages'
Here are some of your options for correcting the problem:
* You can choose a different installation directory, i.e., one that is
on PYTHONPATH or supports .pth files
* You can add the installation directory to the PYTHONPATH environment
variable. (It must then also be on PYTHONPATH whenever you run
Python and want to use the package(s) you are installing.)
* You can set up the installation directory to support ".pth" files by
using one of the approaches described here:
https://setuptools.readthedocs.io/en/latest/easy_install.html#custom-installation-locations
You can first try to compile the normal speed in the folder following:
cd normalSpeed
python3 setup.py build_ext --inplace
cd .. && cp normalSpeed/normalSpeed.* ./
You will get a compiled .so file. For example, normalSpeed.cpython-36m-x86_64-linux-gnu.so
, here *36m*
means python3.6, if you use python3.8 to import such .so
, there will be some error.
thank you for your answer. These are the results python3 setup.py build_ext --inplace
running build_ext
CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
Compatibility with CMake < 2.8.12 will be removed from a future version of
CMake.
Update the VERSION argument <min> value or use a ...<max> suffix to tell
CMake that the project does not need compatibility with older versions.
-- Found pybind11: /home/halodi/.local/share/virtualenvs/test_2_venv-IQxQe5Zj/include (found version "2.7.1" )
CMake Deprecation Warning at Cmake/FindNumPy.cmake:6 (cmake_minimum_required):
Compatibility with CMake < 2.8.12 will be removed from a future version of
CMake.
Update the VERSION argument <min> value or use a ...<max> suffix to tell
CMake that the project does not need compatibility with older versions.
Call Stack (most recent call first):
CMakeLists.txt:14 (include)
-- Configuring done
-- Generating done
-- Build files have been written to: /home/halodi/test_2_venv/normalSpeed/normalSpeed/build/temp.linux-x86_64-3.6
then cd .. && cp normalSpeed/normalSpeed.* ./
cp: -r not specified; omitting directory 'normalSpeed/normalSpeed.egg-info'
then if i run example.py
Traceback (most recent call last):
File "example.py", line 6, in <module>
import normalSpeed
ImportError: /home/halodi/test_2_venv/normalSpeed/normalSpeed.cpython-36m-x86_64-linux-gnu.so: undefined symbol: PyThread_tss_get
please help @ethnhe
Strange then, did you use python3.6 to run the example.py? Try to specify the python version, maybe by:
/usr/bin/python3.6 example.py
so i dont get the previous error but now it doesnt see my packages. The thing is that im working in a venv pipenv.
so i tried
/usr/bin/python3.6 example.py
: gives no module name cv2
pipenv run python3 example.py
: gives the PyThread_tss_get error
pipenv run /usr/bin/python3.6 example.py
: gives no module name cv2
Traceback (most recent call last):
File "example.py", line 4, in <module>
from cv2 import imshow, waitKey, imwrite
ModuleNotFoundError: No module named 'cv2'
pipenv graph gives me :
apex==0.1
cffi==1.11.5
- pycparser [required: Any, installed: 2.20]
easydict==1.7
enum34==1.1.10
future==0.18.2
glumpy==1.0.6
- cython [required: Any, installed: 0.29.24]
- numpy [required: Any, installed: 1.19.5]
- triangle [required: Any, installed: 20200424]
- numpy [required: Any, installed: 1.19.5]
h5py==3.1.0
- cached-property [required: Any, installed: 1.5.2]
- numpy [required: >=1.12, installed: 1.19.5]
lmdb==0.94
opencv-contrib-python==3.4.2.16
- numpy [required: >=1.11.3, installed: 1.19.5]
opencv-python==4.5.3.56
- numpy [required: >=1.13.3, installed: 1.19.5]
pandas==1.1.5
- numpy [required: >=1.15.4, installed: 1.19.5]
- python-dateutil [required: >=2.7.3, installed: 2.8.2]
- six [required: >=1.5, installed: 1.16.0]
- pytz [required: >=2017.2, installed: 2021.1]
plyfile==0.6
- numpy [required: >=1.8, installed: 1.19.5]
pprintpp==0.4.0
pybind11==2.7.1
pybind11-global==2.7.1
PyYAML==5.4.1
scikit-image==0.13.1
- matplotlib [required: >=1.3.1, installed: 3.0.2]
- cycler [required: >=0.10, installed: 0.10.0]
- six [required: Any, installed: 1.16.0]
- kiwisolver [required: >=1.0.1, installed: 1.3.1]
- numpy [required: >=1.10.0, installed: 1.19.5]
- pyparsing [required: >=2.0.1,!=2.1.6,!=2.1.2,!=2.0.4, installed: 2.4.7]
- python-dateutil [required: >=2.1, installed: 2.8.2]
- six [required: >=1.5, installed: 1.16.0]
- networkx [required: >=1.8, installed: 2.5.1]
- decorator [required: >=4.3,<5, installed: 4.4.2]
- pillow [required: >=2.1.0, installed: 8.2.0]
- PyWavelets [required: >=0.4.0, installed: 1.1.1]
- numpy [required: >=1.13.3, installed: 1.19.5]
- scipy [required: >=0.17.0, installed: 1.4.1]
- numpy [required: >=1.13.3, installed: 1.19.5]
- six [required: >=1.7.3, installed: 1.16.0]
sklearn==0.0
- scikit-learn [required: Any, installed: 0.24.2]
- joblib [required: >=0.11, installed: 1.0.1]
- numpy [required: >=1.13.3, installed: 1.19.5]
- scipy [required: >=0.19.1, installed: 1.4.1]
- numpy [required: >=1.13.3, installed: 1.19.5]
- threadpoolctl [required: >=2.0.0, installed: 2.2.0]
torchvision==0.2.0
- numpy [required: Any, installed: 1.19.5]
- pillow [required: >=4.1.1, installed: 8.2.0]
- six [required: Any, installed: 1.16.0]
- torch [required: Any, installed: 1.4.0]
transforms3d==0.3.1
thank you please help @ethnhe
Sorry that I'm not familiar with pipenv. Maybe you need to search for the solution on the internet.
ok so I was able to install it with /usr/bin/python3.6 -m pip install opencv-python
but now i have the same issue of earlier.
Traceback (most recent call last):
File "example.py", line 6, in <module>
import normalSpeed
ImportError: /home/halodi/test_2_venv/normalSpeed/normalSpeed.cpython-36m-x86_64-linux-gnu.so: undefined symbol: PyThread_tss_get
so i think the issue is opencv python version
Update I was able to run the xample with python 3.8 and opencv4. Thanks for all the support
After installing all dependencies, I wanted to test and run the example.py Installation seems to be successful.
the error message is
Please advise @ethnhe