jenkinsci / pyenv-pipeline-plugin

Execute commands in Python virtualenvs in Jenkins Pipeline DSL
https://plugins.jenkins.io/pyenv-pipeline/
MIT License
33 stars 15 forks source link

Error while creating virtualenv with custom python installation #18

Closed gyzpunk closed 6 years ago

gyzpunk commented 6 years ago

I'm facing the following issue when trying to use withPythonEnv in combination with ShiningPanda for a custom Python (miniconda3):

$ /SERVICE/python/bin/python3 -m virtualenv --python=/SERVICE/python/bin/python3 /workspace_dir/.pyenv-python3

returns:

ERROR: Error while creating virtualenv: /workspace_dir/.pyenv-python3/bin/python3: error while loading shared libraries: libpython3.6m.so.1.0: cannot open shared object file: No such file or directory
Already using interpreter /SERVICE/python/bin/python3
Using base prefix '/SERVICE/python'
New python executable in /workspace_dir/.pyenv-python3/bin/python3
Also creating executable in /workspace_dir/.pyenv-python3/bin/python
ERROR: The executable /workspace_dir/.pyenv-python3/bin/python3 is not functioning
ERROR: It thinks sys.prefix is '/MYHOST/home/myuser/.jenkins_slave' (should be '/workspace_dir/.pyenv-python3')
ERROR: virtualenv is not compatible with this system or executable

Here is my pipeline step:

withPythonEnv('python3') {
  pysh "pip install sphinx"
  pysh "sphinx-build -b html docs/source docs/build"
}

But, the following step is behaving well (which is roughly what the previous should do):

sh '/SERVICE/python/bin/python3 -m virtualenv --python=/SERVICE/python/bin/python3 venv'
sh '. ./venv/bin/activate && pip install -U sphinx && sphinx-build -b html docs/source docs/build'

The environment variable LD_LIBRARY_PATH is properly configured in my Jenkins global configuration and contains a lib path with libpython3.6m.so.1.0 in it.

withPythonEnv is behaving as it is flushing the whole env variables (or creating a new shell out of Jenkins ?) and then loosing all the variables customization available in Jenkins.

cstarner commented 6 years ago

withPythonEnv was previously not playing nicely with environmental variables; however that has been remedied with version 2.0.0. I recommend upgrading to the new version, and seeing if your problems persist.

cstarner commented 6 years ago

Closing due to inactivity