@simonmichal thanks for all of your help! Responding inline

@raymondEhlers : thanks for your comment, could you provide a more concrete example on how to determine the pyenv installation to be used?

My understanding is that:

* `PYENV_ROOT` contains path to `.pyenv` location, for example: /home/username/.pyenv

Agreed

* `pyenv prefix` will return `venv` prefix or simply `/usr`

I'm not sure this is quite right. Running some tests on my systems, using the system python with pyenv prefix will indeed return /usr. But for non-system versions, it will return the path to the python installed via pyenv, not the virtualenv. See below:

[13:20] rehlers@pc059 /software/rehlers/dev/quarantine $ lsl
[13:33] rehlers@pc059 rehlers/dev/quarantine/pyenv-tests $ pyenv versions
  system
  3.6-system
  3.7.7
* 3.9.2 (set by /software/rehlers/dev/quarantine/.python-version)
[13:33] rehlers@pc059 rehlers/dev/quarantine/pyenv-tests $ pyenv prefix
/software/rehlers/software/pyenv/versions/3.9.2
[13:33] rehlers@pc059 rehlers/dev/quarantine/pyenv-tests $ pyenv local 3.7.7
[13:33] rehlers@pc059 rehlers/dev/quarantine/pyenv-tests $ pyenv version
3.7.7 (set by /software/rehlers/dev/quarantine/pyenv-tests/.python-version)
[13:33] rehlers@pc059 rehlers/dev/quarantine/pyenv-tests $ pyenv prefix
/software/rehlers/software/pyenv/versions/3.7.7
[13:33] rehlers@pc059 rehlers/dev/quarantine/pyenv-tests $ python3 -m venv venv
[13:33] rehlers@pc059 rehlers/dev/quarantine/pyenv-tests $ source venv/bin/activate
(venv) [13:34] rehlers@pc059 rehlers/dev/quarantine/pyenv-tests $ pyenv version
3.7.7 (set by /software/rehlers/dev/quarantine/pyenv-tests/.python-version)
(venv) [13:34] rehlers@pc059 rehlers/dev/quarantine/pyenv-tests $ pyenv prefix
/software/rehlers/software/pyenv/versions/3.7.7
(venv) [13:34] rehlers@pc059 rehlers/dev/quarantine/pyenv-tests $ which python-config
/software/rehlers/software/pyenv/shims/python-config
(venv) [13:34] rehlers@pc059 rehlers/dev/quarantine/pyenv-tests $ which python3-config
/software/rehlers/software/pyenv/shims/python3-config

So, I think libpython.so will always at $(pyenv prefix)/lib/libpython3.so, and the headers will be at $(pyenv prefix)/include

* `python-config` has to be installed with python devel package

As a note, on both of my systems, I see that pyenv shims python-config and therefore will provide it via the python installation, but I can't rule out that it's shimming it because it was already installed via the python-dev package. I'll try to verify in a docker container

It would be great if we could come up with a docker based scenario where we could test the pip installation, e.g.

docker run -it --rm ubuntu:bionic /bin/bash

apt-get update
apt-get -y install python3.7 python3-pip python3.7-venv pkg-config cmake uuid-dev libssl-dev libz-dev

PYTHON_CONFIGURE_OPTS='--enable-shared' pyenv install 3.7-dev
PYTHON_CONFIGURE_OPTS='--enable-shared' pyenv install 3.7.11

In this scenario we have two installations with libpython3.so:

* `~/.pyenv/versions/3.7-dev/lib/libpython3.so`

* `~/.pyenv/versions/3.7.11/lib/libpython3.so`

Could you give me a snipped of python code or shell script that will decide which one to choose?

If it's acceptable, I think it would be much simpler to retrieve this via pyenv version. There are many different ways to specify the version (.python-version files, PYENV_VERSION, etc), which could make this rather brittle. The full description is here

I'll play around with a docker container a bit to try to independently confirm a few of my statements above, but I think pyenv prefix should always contain the python lib of interest


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.

[ { "@context": "http://schema.org", "@type": "EmailMessage", "potentialAction": { "@type": "ViewAction", "target": "https://github.com/xrootd/xrootd/issues/1474#issuecomment-911578253", "url": "https://github.com/xrootd/xrootd/issues/1474#issuecomment-911578253", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { "@type": "Organization", "name": "GitHub", "url": "https://github.com" } } ]

Use REPLY-ALL to reply to list

To unsubscribe from the XROOTD-DEV list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=XROOTD-DEV&A=1