strawlab / python-pcl

Python bindings to the pointcloud library (pcl)
http://strawlab.github.com/python-pcl/
Other
2k stars 700 forks source link

How does one import python-pcl in a virtual environment (MacOs)? #331

Open mnshn opened 4 years ago

mnshn commented 4 years ago

I have python-pcl working properly "globally", that is: after successfully installing pcl and python-pcl, I can successfully import pcl in my python project.

However, I'd prefer to work in a virtual environment, using Python's venv. When I Install python-pcl in my virtual enviroment, the module no longer imports poperly, and instead I get an ImportError:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/pauldelange/meg/opm/opm-finder/venv/lib/python3.7/site-packages/pcl/__init__.py", line 2, in <module>
    from ._pcl import *
ImportError: dlopen(/Users/pauldelange/meg/opm/opm-finder/venv/lib/python3.7/site-packages/pcl/_pcl.cpython-37m-darwin.so, 2): Library not loaded: /usr/local/opt/qt/lib/QtWidgets.framework/Versions/5/QtWidgets
  Referenced from: /usr/local/opt/pcl/lib/libpcl_outofcore.1.9.dylib
  Reason: Incompatible library version: libpcl_outofcore.1.9.dylib requires version 5.12.0 or later, but QtWidgets provides version 5.7.0

Your Environment

Context

I am trying to run python-pcl in a (python) virtual environment (using venv) after activating the venv, and installing python pcl with pip

Expected Behavior

Given that globally -- not using venv -- the python-pcl package is properly imported, I would expect a successful import in my virtual environment also

Current Behavior

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/pauldelange/meg/opm/opm-finder/venv/lib/python3.7/site-packages/pcl/__init__.py", line 2, in <module>
    from ._pcl import *
ImportError: dlopen(/Users/pauldelange/meg/opm/opm-finder/venv/lib/python3.7/site-packages/pcl/_pcl.cpython-37m-darwin.so, 2): Library not loaded: /usr/local/opt/qt/lib/QtWidgets.framework/Versions/5/QtWidgets
  Referenced from: /usr/local/opt/pcl/lib/libpcl_outofcore.1.9.dylib
  Reason: Incompatible library version: libpcl_outofcore.1.9.dylib requires version 5.12.0 or later, but QtWidgets provides version 5.7.0

Code to Reproduce

1. python -m venv venv
2. source venv/bin/activate
3. pip install python-pcl
4. python -c 'import pcl'

Possible Solution

davethejoy commented 4 years ago

Having the same issue with conda, in my case libpcl_outofcore.1.9.dylib is nowhere to be found. Tx in advance!

xleEmesent commented 4 years ago

Having the same issue in Ubuntu 18.04.5 LTS. Has anyone found a solution yet?

where2go947 commented 1 year ago

https://github.com/strawlab/python-pcl/issues/374#issuecomment-1318440769 Hope helps.