Skip to content
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

What is utils_lib package #2

Closed
NagabhushanSN95 opened this issue Mar 19, 2021 · 8 comments
Closed

What is utils_lib package #2

NagabhushanSN95 opened this issue Mar 19, 2021 · 8 comments

Comments

@NagabhushanSN95
Copy link

Hi

testing.py imports utils_lib as pytools in first line. What is this package? How to install this?

@soulslicer
Copy link
Owner

you are suppose to compile it

@NagabhushanSN95
Copy link
Author

Oh! Can you please guide me on how to compile it? I'm very new to using c++ with python and I have no experience in c or c++

@soulslicer
Copy link
Owner

you can find it in readme

@NagabhushanSN95
Copy link
Author

You mean this?

mkdir build;
cd build;
cmake ..;
make
python3 testing.py

I've already done this. Still I'm getting the error

(soulslicer) $ export OpenCV_DIR=.../OpenCV
(soulslicer) $ cmake ..;
-- Found OpenMP_C: -fopenmp  
-- Found OpenMP_CXX: -fopenmp  
-- Found OpenMP: TRUE   
-- Found OpenCV: .../OpenCV (found version "3.4.1") 
-- Found PythonInterp: /usr/bin/python3.6 (found version "3.6.9") 
-- Found PythonLibs: /usr/lib/x86_64-linux-gnu/libpython3.6m.so
-- Performing Test HAS_CPP14_FLAG
-- Performing Test HAS_CPP14_FLAG - Success
-- pybind11 v2.3.dev1
-- Performing Test HAS_FLTO
-- Performing Test HAS_FLTO - Success
-- LTO enabled
-- Configuring done
-- Generating done
-- Build files have been written to: .../004_soulslicer/src/build
(soulslicer) $ make
Scanning dependencies of target utils_lib
[ 50%] Building CXX object CMakeFiles/utils_lib.dir/python/utils_lib.cpp.o
[100%] Linking CXX shared module utils_lib.cpython-36m-x86_64-linux-gnu.so
[100%] Built target utils_lib

(soulslicer) $ python3 testing.py
Traceback (most recent call last):
  File "testing.py", line 1, in <module>
    import utils_lib as pyutils
ModuleNotFoundError: No module named 'utils_lib'
(soulslicer) $

@NagabhushanSN95
Copy link
Author

These are the contents of the build directory and I'm running testing.py within build directory

CMakeCache.txt  CMakeFiles  cmake_install.cmake  __init__.py  Makefile  pybind11  testing.py  utils_lib.cpython-36m-x86_64-linux-gnu.so

@NagabhushanSN95
Copy link
Author

Creating a symlink as follows helped

ln -s utils_lib.cpython-36m-x86_64-linux-gnu.so utils_lib.so

However, it is compiled for python3.6, which I guess it took from my system python. However, my conda environment is python 3.8. So, I'm getting the following error

Python version mismatch: module was compiled for Python 3.6, but the interpreter version is incompatible: 3.8.3 | packaged by conda-forge | (default, Jun  1 2020, 17:43:00)

Can you help me to compile the file for python 3.8? Basically I need to tell cmake/make to use the python in the conda environment and not system python

@soulslicer
Copy link
Owner

cmake -DPYTHON_EXECUTABLE  /usr/bin/python3.5 -DPYTHON_LIBRARY /usr/lib/x86_64-linux-gnu/libpython3.5m.so ..

@NagabhushanSN95
Copy link
Author

Thanks! That worked. I had to put = as in -DPYTHON_EXECUTABLE=/usr/bin/python3.5 and it worked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants