-
Notifications
You must be signed in to change notification settings - Fork 835
Problem importing camelot #2338
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
Comments
The root of the cause is most likely that environment variables are not set up correctly. There's some previous comments about this at #1554 and #1896. You might want to try out PyOxidizer, which can pack all of your Rust and Python code together and might help avoid you needing to figure out a solution. |
Will close this issue as there's been no further discussion in the past 4 months. |
@davidhewitt, now I also ran into the [dependencies]
opencv = {version = "0.82.1"}
[dependencies.pyo3]
version = "0.19.0"
features = ["abi3-py38","extension-module"] # "abi3-py38" tells pyo3 (and maturin) to build using the stable ABI with minimum Python version 3.8 I did make opencv work out in pure rust project. But here in a lib project with pyo3, I failed when using the final produced python module. I wonder what I need to do to fix it. I've tried to add the file path manually by: opencv_lib_path = os.path.abspath(r'C:\tools\opencv\build\x64\vc16\bin')
sys.path.append(opencv_lib_path) But still, not working.=_= |
@dbsxdbsx check that |
Yes, it is in @davidhewitt , do you mean exactly |
Uh oh!
There was an error while loading. Please reload this page.
My Environment:
Operating system and version: Windows 10
Python version: 3.8.3
How did I install python: Anaconda default Python installation
Did I use a virtualenv?: yes, I use a virtualenv to pack all the libraries that I need for the specific project
My Rust version (rustc --version): 1.59.0
MyPyO3 version: 0.16.4
I am new to Rust.
I need to read some tables from pdf files, and did´t find any satisfactory high-level Rust crate. So I decided to use camelot (Python) which I had used successfully before, and call it from inside my Rust program.
First I was having all sorts of problems with PyO3 not finding my Python interpreter, and while researching, I found it could be solved by setting PYTHONHOME and PYTHONPATH. It did solve this problem, but broke my Anaconda installation, so I researched a bit further and found that cgranade solution to issue #1554 can solve it.
But now I have a problem with importing the camelot library. It is inside a virtua env and I reckon I should probably point to the Pyrhon version that is inside the virtual env. This is my code:
And this is the full error I get:
C:\Users\mazrodrigues\Anaconda3\envs\pdf_extract\lib\site-packages\numpy\__init__.py:148: UserWarning: mkl-service package failed to import, therefore Intel(R) MKL initialization ensuring its correct out-of-the box operation under condition when Gnu OpenMP had already been loaded by Python process is not assured. Please install mkl-service package, see http://github.com/IntelPython/mkl-service from . import _distributor_init thread 'main' panicked at 'called
Result::unwrap()on an
Errvalue: PyErr { type: <class 'ImportError'>, value: ImportError('\n\nIMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!\n\nImporting the numpy C-extensions failed. This error can happen for\nmany reasons, often due to issues with your setup or how NumPy was\ninstalled.\n\nWe have compiled some common reasons and troubleshooting tips at:\n\n https://numpy.org/devdocs/user/troubleshooting-importerror.html\n\nPlease note and check the following:\n\n * The Python version is: Python3.8 from "C:\\Users\\mazrodrigues\\Documents\\10_Rust\\01_Treinamento\\01_Genericos\\05_py03\\v06\\target\\debug\\v01.exe"\n * The NumPy version is: "1.21.5"\n\nand make sure that they are the versions you expect.\nPlease carefully study the documentation linked above for further help.\n\nOriginal error was: DLL load failed while importing _multiarray_umath: Não foi possível encontrar o módulo especificado.\n'), traceback: Some(<traceback object at 0x000002666038F900>) }', src\main.rs:62:55 note: run with
RUST_BACKTRACE=1environment variable to display a backtrace error: process didn't exit successfully:
target\debug\v01.exe(exit code: 101)
By the error message it seems that there is something wrong with my Numpy installation (which is a dependency of camelot), but when I run with Python in Jupyter Notebook it works fine, so there is nothing wrong with the installation.
Can someone help me with this?
The text was updated successfully, but these errors were encountered: