If I install a package with "python setup.py install", it works fine; but if I do "python setup.py sdist" and then "pip install " it does not. The problem seems to be that in the former case the files are installed in the expected site-packages sub-directory, while in the latter they're installed off exec_prefix. Demonstration attached; if I run demo.bash on an Ubuntu 18.04 amd64 system, I get the output below.
This is a demonstration what I think is the same problem we're having with Slycot; see, e.g., python-control/Slycot#3 . We've got conda packages that work, but "pip install slycot" fails.
skbuild-example.tar.gz
+ rm -rf .venvs
+ mkdir .venvs
+ python3 --version
Python 3.7.3
+ python3 -m venv .venvs/skex
+ set +x
++ python -c 'import sys; print(sys.exec_prefix)'
+ pyprefix=/home/rory/projects/pycontrol/skbuild-example/.venvs/skex
+ pip --quiet install --upgrade pip setuptools wheel scikit-build
+ python setup.py install
Not searching for unused variables given on the command line.
CMake Error: CMake was unable to find a build program corresponding to "Ninja". CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.
-- Configuring incomplete, errors occurred!
See also "/home/rory/projects/pycontrol/skbuild-example/_cmake_test_compile/build/CMakeFiles/CMakeOutput.log".
Not searching for unused variables given on the command line.
-- The C compiler identification is GNU 7.4.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
-- The Fortran compiler identification is GNU 7.4.0
-- Check for working Fortran compiler: /usr/bin/gfortran
-- Check for working Fortran compiler: /usr/bin/gfortran -- works
-- Detecting Fortran compiler ABI info
-- Detecting Fortran compiler ABI info - done
-- Checking whether /usr/bin/gfortran supports Fortran 90
-- Checking whether /usr/bin/gfortran supports Fortran 90 -- yes
-- Configuring done
-- Generating done
-- Build files have been written to: /home/rory/projects/pycontrol/skbuild-example/_cmake_test_compile/build
-- The C compiler identification is GNU 7.4.0
-- The Fortran compiler identification is GNU 7.4.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 Fortran compiler: /usr/bin/gfortran
-- Check for working Fortran compiler: /usr/bin/gfortran -- works
-- Detecting Fortran compiler ABI info
-- Detecting Fortran compiler ABI info - done
-- Checking whether /usr/bin/gfortran supports Fortran 90
-- Checking whether /usr/bin/gfortran supports Fortran 90 -- yes
-- Found PythonInterp: /home/rory/projects/pycontrol/skbuild-example/.venvs/skex/bin/python (found version "3.7.3")
-- Found PythonLibs: /home/rory/.miniconda3/envs/skbuild-numpy/lib/libpython3.7m.so (found version "3.7.3")
-c:42: DeprecationWarning: SO is deprecated, use EXT_SUFFIX
-- building w/ scikit-build
-- Performing Test Weak Link MODULE -> SHARED (gnu_ld_ignore) - Success
_modinit_prefix:PyInit_
-- Configuring done
-- Generating done
-- Build files have been written to: /home/rory/projects/pycontrol/skbuild-example/_skbuild/linux-x86_64-3.7/cmake-build
Scanning dependencies of target spam
[ 50%] Building C object CMakeFiles/spam.dir/spammodule.c.o
[100%] Linking C shared module spam.cpython-37m-x86_64-linux-gnu.so
[100%] Built target spam
Install the project...
-- Install configuration: "Release"
-- Installing: /home/rory/projects/pycontrol/skbuild-example/_skbuild/linux-x86_64-3.7/cmake-install/spam/spam.cpython-37m-x86_64-linux-gnu.so
--------------------------------------------------------------------------------
-- Trying "Ninja" generator
--------------------------------
---------------------------
----------------------
-----------------
------------
-------
--
--
-------
------------
-----------------
----------------------
---------------------------
--------------------------------
-- Trying "Ninja" generator - failure
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-- Trying "Unix Makefiles" generator
--------------------------------
---------------------------
----------------------
-----------------
------------
-------
--
--
-------
------------
-----------------
----------------------
---------------------------
--------------------------------
-- Trying "Unix Makefiles" generator - success
--------------------------------------------------------------------------------
running install
running bdist_egg
running egg_info
creating spam.egg-info
writing spam.egg-info/PKG-INFO
writing dependency_links to spam.egg-info/dependency_links.txt
writing top-level names to spam.egg-info/top_level.txt
writing manifest file 'spam.egg-info/SOURCES.txt'
reading manifest file 'spam.egg-info/SOURCES.txt'
writing manifest file 'spam.egg-info/SOURCES.txt'
installing library code to _skbuild/linux-x86_64-3.7/setuptools/bdist.linux-x86_64/egg
running install_lib
running build_ext
warning: install_lib: '_skbuild/linux-x86_64-3.7/setuptools/lib' does not exist -- no Python modules to install
installing package data to _skbuild/linux-x86_64-3.7/setuptools/bdist.linux-x86_64/egg
running install_data
creating _skbuild/linux-x86_64-3.7/setuptools/bdist.linux-x86_64
creating _skbuild/linux-x86_64-3.7/setuptools/bdist.linux-x86_64/egg
creating _skbuild/linux-x86_64-3.7/setuptools/bdist.linux-x86_64/egg/spam
copying _skbuild/linux-x86_64-3.7/cmake-install/spam/spam.cpython-37m-x86_64-linux-gnu.so -> _skbuild/linux-x86_64-3.7/setuptools/bdist.linux-x86_64/egg/spam
creating _skbuild/linux-x86_64-3.7/setuptools/bdist.linux-x86_64/egg/EGG-INFO
copying spam.egg-info/PKG-INFO -> _skbuild/linux-x86_64-3.7/setuptools/bdist.linux-x86_64/egg/EGG-INFO
copying spam.egg-info/SOURCES.txt -> _skbuild/linux-x86_64-3.7/setuptools/bdist.linux-x86_64/egg/EGG-INFO
copying spam.egg-info/dependency_links.txt -> _skbuild/linux-x86_64-3.7/setuptools/bdist.linux-x86_64/egg/EGG-INFO
copying spam.egg-info/not-zip-safe -> _skbuild/linux-x86_64-3.7/setuptools/bdist.linux-x86_64/egg/EGG-INFO
copying spam.egg-info/top_level.txt -> _skbuild/linux-x86_64-3.7/setuptools/bdist.linux-x86_64/egg/EGG-INFO
creating dist
creating 'dist/spam-0.0.2-py3.7-linux-x86_64.egg' and adding '_skbuild/linux-x86_64-3.7/setuptools/bdist.linux-x86_64/egg' to it
removing '_skbuild/linux-x86_64-3.7/setuptools/bdist.linux-x86_64/egg' (and everything under it)
Processing spam-0.0.2-py3.7-linux-x86_64.egg
creating /home/rory/projects/pycontrol/skbuild-example/.venvs/skex/lib/python3.7/site-packages/spam-0.0.2-py3.7-linux-x86_64.egg
Extracting spam-0.0.2-py3.7-linux-x86_64.egg to /home/rory/projects/pycontrol/skbuild-example/.venvs/skex/lib/python3.7/site-packages
Adding spam 0.0.2 to easy-install.pth file
Installed /home/rory/projects/pycontrol/skbuild-example/.venvs/skex/lib/python3.7/site-packages/spam-0.0.2-py3.7-linux-x86_64.egg
Processing dependencies for spam==0.0.2
Finished processing dependencies for spam==0.0.2
+ find /home/rory/projects/pycontrol/skbuild-example/.venvs/skex -iname 'spam*'
/home/rory/projects/pycontrol/skbuild-example/.venvs/skex/lib/python3.7/site-packages/spam-0.0.2-py3.7-linux-x86_64.egg
/home/rory/projects/pycontrol/skbuild-example/.venvs/skex/lib/python3.7/site-packages/spam-0.0.2-py3.7-linux-x86_64.egg/spam
/home/rory/projects/pycontrol/skbuild-example/.venvs/skex/lib/python3.7/site-packages/spam-0.0.2-py3.7-linux-x86_64.egg/spam/spam.cpython-37m-x86_64-linux-gnu.so
+ python -c 'import spam'
+ rm -rf spam.egg-info
+ set +x
+ echo
+ echo '---------------------- sdist and pip install ---------------------'
---------------------- sdist and pip install ---------------------
+ echo
+ python3 -m venv .venvs/skex-2
+ set +x
++ python -c 'import sys; print(sys.exec_prefix)'
+ pyprefix=/home/rory/projects/pycontrol/skbuild-example/.venvs/skex-2
+ pip --quiet install --upgrade pip setuptools wheel scikit-build
+ python setup.py sdist
running sdist
running generate_source_manifest
running check
reading manifest file 'MANIFEST'
creating spam-0.0.2
copying files to spam-0.0.2...
copying CMakeLists.txt -> spam-0.0.2
copying demo.bash -> spam-0.0.2
copying pyproject.toml -> spam-0.0.2
copying setup.py -> spam-0.0.2
copying spammodule.c -> spam-0.0.2
copied 5 files
creating 'dist/spam-0.0.2' gztar archive and adding 'spam-0.0.2' to it
Creating tar archive
removing 'spam-0.0.2' (and everything under it)
+ python -m pip --no-color install --progress-bar=off dist/spam-0.0.2.tar.gz
Processing ./dist/spam-0.0.2.tar.gz
Installing build dependencies: started
Installing build dependencies: finished with status 'done'
Getting requirements to build wheel: started
Getting requirements to build wheel: finished with status 'done'
Preparing wheel metadata: started
Preparing wheel metadata: finished with status 'done'
Building wheels for collected packages: spam
Building wheel for spam (PEP 517): started
Building wheel for spam (PEP 517): finished with status 'done'
Stored in directory: /home/rory/.cache/pip/wheels/1c/94/35/3bab4dc6db7f4b95b8b3ba901596d132358da06583906114e5
Successfully built spam
Installing collected packages: spam
Successfully installed spam-0.0.2
+ find /home/rory/projects/pycontrol/skbuild-example/.venvs/skex-2 -iname 'spam*'
/home/rory/projects/pycontrol/skbuild-example/.venvs/skex-2/lib/python3.7/site-packages/spam-0.0.2.dist-info
/home/rory/projects/pycontrol/skbuild-example/.venvs/skex-2/spam
/home/rory/projects/pycontrol/skbuild-example/.venvs/skex-2/spam/spam.cpython-37m-x86_64-linux-gnu.so
+ python -c 'import spam'
Traceback (most recent call last):
File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'spam'
If I install a package with "python setup.py install", it works fine; but if I do "python setup.py sdist" and then "pip install " it does not. The problem seems to be that in the former case the files are installed in the expected site-packages sub-directory, while in the latter they're installed off exec_prefix. Demonstration attached; if I run
demo.bashon an Ubuntu 18.04 amd64 system, I get the output below.This is a demonstration what I think is the same problem we're having with Slycot; see, e.g., python-control/Slycot#3 . We've got conda packages that work, but "pip install slycot" fails.
skbuild-example.tar.gz