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

can't install with pip2 or pip3 #28

Open
ahundt opened this issue Jan 8, 2019 · 4 comments
Open

can't install with pip2 or pip3 #28

ahundt opened this issue Jan 8, 2019 · 4 comments

Comments

@ahundt
Copy link

ahundt commented Jan 8, 2019

@gergondet It seems the python bindings setup only works with pip, the cmake script doesn't appear to support pip2 or pip3. This applies to the other repositories with bindings as well.

@ahundt
Copy link
Author

ahundt commented Jan 8, 2019

OK I figured out what is wrong, pip isn't being found correctly. The link below contains a fixed version
binding/python/CMakeLists.txt

The key to fixing it is to find all versions of pip, then install with each one:

FIND_PROGRAM(PIP NAMES pip pip2 pip3 HINTS $ENV{HOME}/.local/bin)
FIND_PROGRAM(PIP2 NAMES pip2 HINTS $ENV{HOME}/.local/bin)
FIND_PROGRAM(PIP3 NAMES pip3 HINTS $ENV{HOME}/.local/bin)

I'm not sure what additional directory hints you will need, but I'm sure there will be some. This fix also needs to be replicated in all jrl packages that do pip install in a CMakeLists.txt file.

@gergondet
Copy link
Member

The reasoning for the building of the Python bindings is to use pip and python as default which should result in the default system version or the virtualenv version. For example, on Travis, we use a virtualenv without further modifications to the cmake options and it works fine. It's a bit surprising that your setup does not have a pip/python in place.

In fact, there is no way to build both Python 2 and Python 3 bindings from cmake (except for the packaging but this uses specific options that should not be used for regular usage). The user can only opt-in to force a Python 3 build. I'd welcome a patch that allows to build both.

However, I'm not sure it's sufficient to install with pip2 and pip3 and we might want to also explicitly build with python2 and python3 (otherwise the Python 2 or Python 3 bindings are built at install time which is not exactly ideal)

FIND_PROGRAM(PIP NAMES pip pip2 pip3 HINTS $ENV{HOME}/.local/bin)
FIND_PROGRAM(PIP2 NAMES pip2 HINTS $ENV{HOME}/.local/bin)
FIND_PROGRAM(PIP3 NAMES pip3 HINTS $ENV{HOME}/.local/bin)

I would remove the hints here because it will conflict with the usage of virtualenv (according to cmake documentation HINTS come before the environment path)

@ahundt
Copy link
Author

ahundt commented Jan 14, 2019

For example, on Travis, we use a virtualenv without further modifications to the cmake options and it works fine.

I've not really utilized virtualenv substantially, unfortunately.

It's a bit surprising that your setup does not have a pip/python in place.

I use both python2 and python3 depending on the project, so pip alone wouldn't be sufficient. I'm hoping to install everywhere in one go, though it would be fine to have 3 lines on my build script, one for each version.

However, I'm not sure it's sufficient to install with pip2 and pip3 and we might want to also explicitly build with python2 and python3 (otherwise the Python 2 or Python 3 bindings are built at install time which is not exactly ideal)

How do you suggest? I guess the cmake scripts might only support one python at a time, and simultaneous multi-python support may a lot more effort than a couple extra lines in a build script.

I would remove the hints here because it will conflict with the usage of virtualenv (according to cmake documentation HINTS come before the environment path)

Hmm, do you suggest a parameter other than HINTS?

@gergondet
Copy link
Member

Hi @ahundt ,

I believe #31 addresses this. See the new CMake option to build both Python 2 and Python 3 as well as enforcing python2/pip2 and python3/pip3 respectively.

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