Skip to content

try/except for site.getsitepackages() #243

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

Merged
merged 1 commit into from
Sep 25, 2019
Merged

Conversation

guruofquality
Copy link
Contributor

In the never ending python install path whack-a-mole, site.getsitepackages() sometimes does not exist

In the never ending python install path whack-a-mole,
site.getsitepackages() sometimes does not exist
@gasparka
Copy link

Error is fixed, but install prefix is wrong (/usr/local). It should be set to $VIRTUAL_ENV (/home/gaspar/git/rantelon/detector/venv) if exist.

Cmake log:

(venv) gaspar@RA-108 ~/git/rantelon/detector/environment/SoapySDR/build (master)> cmake ..
-- The C compiler identification is GNU 9.1.0
-- The CXX compiler identification is GNU 9.1.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Build type not specified: defaulting to release.
-- Found Doxygen: /usr/bin/doxygen (found version "1.8.16") found components:  doxygen dot 
-- 
-- #############################################
-- ## Begin configuration for Python support...
-- #############################################
-- Enabling optional Python bindings if possible...
-- Found SWIG: /usr/bin/swig (found version "4.0.1") 
-- SWIG_FOUND: TRUE - 4.0.1
-- Found PythonInterp: /home/gaspar/git/rantelon/detector/venv/bin/python (found version "3.7.4") 
-- PYTHONINTERP_FOUND: TRUE - 3.7.4
-- PYTHON_EXECUTABLE: /home/gaspar/git/rantelon/detector/venv/bin/python
-- PYTHON_INSTALL_DIR: ${prefix}/lib/python3.7/site-packages
-- PYTHONLIBS_FOUND: TRUE - 3.7.4
-- PYTHON_INCLUDE_DIRS: /home/gaspar/git/rantelon/detector/venv/include/python3.7m;/home/gaspar/git/rantelon/detector/venv/include/python3.7m
-- PYTHON_LIBRARIES: -lpython3.7m -lcrypt -lpthread -ldl -lutil -lm -Xlinker -export-dynamic
-- Performing Test SIZE_T_IS_UNSIGNED_INT
-- Performing Test SIZE_T_IS_UNSIGNED_INT - Failed
-- CMAKE_SWIG_FLAGS=-c++;-threads;-I/home/gaspar/git/rantelon/detector/environment/SoapySDR/include
CMake Warning (dev) at /usr/share/cmake-3.15/Modules/UseSWIG.cmake:607 (message):
  Policy CMP0078 is not set: UseSWIG generates standard target names.  Run
  "cmake --help-policy CMP0078" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.

Call Stack (most recent call first):
  python/CMakeLists.txt:155 (SWIG_ADD_LIBRARY)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at /usr/share/cmake-3.15/Modules/UseSWIG.cmake:460 (message):
  Policy CMP0086 is not set: UseSWIG honors SWIG_MODULE_NAME via -module
  flag.  Run "cmake --help-policy CMP0086" for policy details.  Use the
  cmake_policy command to set the policy and suppress this warning.

Call Stack (most recent call first):
  /usr/share/cmake-3.15/Modules/UseSWIG.cmake:702 (SWIG_ADD_SOURCE_TO_MODULE)
  python/CMakeLists.txt:155 (SWIG_ADD_LIBRARY)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- 
-- #############################################
-- ## Begin configuration for Python3 support...
-- #############################################
-- Enabling optional Python3 bindings if possible...
-- 
-- ######################################################
-- ## SoapySDR enabled features
-- ######################################################
-- 
 * Library, runtime library v0.8.0-gcafa4ba5
 * Apps, command line applications
 * Tests, library unit tests
 * Docs, doxygen documentation
 * Python, python bindings v3.7.4

-- ######################################################
-- ## SoapySDR disabled features
-- ######################################################
-- 

-- SoapySDR version: v0.8.0-gcafa4ba5
-- ABI/so version: v0.8
-- Install prefix: /usr/local
-- Configuring done
-- Generating done
-- Build files have been written to: /home/gaspar/git/rantelon/detector/environment/SoapySDR/build

@guruofquality
Copy link
Contributor Author

Error is fixed,

Thanks

but install prefix is wrong (/usr/local). It should be set to $VIRTUAL_ENV (/home/gaspar/git/rantelon/detector/venv) if exist.

You are going to want to pass this to cmake: -DCMAKE_INSTALL_PREFIX=$VIRTUAL_ENV

@guruofquality guruofquality merged commit 189bc69 into master Sep 25, 2019
@guruofquality guruofquality deleted the get_python_lib branch September 25, 2019 02:10
@gasparka
Copy link

IMO #239 is not yet solved.

My argument is that -DCMAKE_INSTALL_PREFIX=$VIRTUAL_ENV should be set automatically because current situation results in broken install (using "naively" cmake .. in virtualenv). That is, install succeeds BUT you cant import SoapySDR - that is confusing to people who have little experience with cmake.

Is there any downside of setting it automatically (i mean only if $VIRTUAL_ENV is set, and of course it can be overwritten with -DCMAKE_INSTALL_PREFIX)?

@guruofquality
Copy link
Contributor Author

Double checking: Should the libsoapysdr.so, support modules, and includes go into /usr/local, and the python modules should go into $VIRTUAL_ENV. Or all of the install, every lib and include should also be in the same $VIRTUAL_ENV prefix?

@gasparka
Copy link

My vision is that everything goes into $VIRTUAL_ENV, main system will stay untouched.

@guruofquality
Copy link
Contributor Author

There could be upwards of 100 projects in this ecosystem from drivers to applications that would need to understand a new default for the install prefix (both cmake and autotools stuff --prefix). Typically the build projects try to stay generic but support configuration variables. And then depending upon the system, these variables are scripted in a way to match the target system. debian has a rules file, homebrew has recipes and standard cmake args, im sure setup.py could be scripted to do something too.

@gasparka
Copy link

My idea was that $VIRTUAL_ENV is used only if set - this happens when user has activated the virtual environment. Builds out of virtual environment will stay the same.

However, i understand that this use case is not that common, lets see if there are more people interested.

Thanks for help!

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

Successfully merging this pull request may close these issues.

Installing in virtualenv not trivial
2 participants