Hi everyone, I am trying a new way to setup a python development environment (just to have all the options: python packages from guix, creating python packages definitions) in this iteration I am trying to install python packages using pip3
. I am following this set of notes: https://github.com/pjotrp/guix-notes/blob/master/PYTHON.org#isolated-module-installation and direnv
(following the excellent tropin's video (https://www.youtube.com/watch?v=GzzxTT1uU-M)
So my setup is:
.envrc
:
``` use guixs python
PYTHONBIN=$(readlink -f which python3
) PYTHONHASH=$(basename $(dirname $(dirname $PYTHONBIN))) echo $PYTHONHASH export PREFIX_PATH=$HOME/.python_guix/$PYTHONHASH ```
After running ddirenv allow
I got:
$ which python3 /gnu/store/7xs29qssk1m7m13lk1lbr4ydj70nzj9c-profile/bin/python3
$ which pip3 /gnu/store/7xs29qssk1m7m13lk1lbr4ydj70nzj9c-profile/bin/pip3
$ echo $PREFIX_PATH /home/nanounanue/.python_guix/abznl1yzi6isa57mh1mj3fsdylksqd7m-python-3.8.2
So everything seems fine. So, I run:
$ pip3 install --install-option="--prefix='$PREFIX_PATH'" pptx2md
I got a nasty error:
``` /gnu/store/7xs29qssk1m7m13lk1lbr4ydj70nzj9c-profile/lib/python3.8/site-packages/pip/_internal/commands/install.py:243: UserWarning: Disabling all use of wheels due to the use of --build-options / --global-options / --install-options. cmdoptions.check_install_build_global(options) Collecting pptx2md Using cached https://files.pythonhosted.org/packages/db/10/2cd214da27344f033e1d5b93baad4389963feb620e11d864005a49e6d70c/pptx2md-1.1.1.tar.gz Collecting python-pptx (from pptx2md) Using cached https://files.pythonhosted.org/packages/eb/c3/bd8f2316a790291ef5aa5225c740fa60e2cf754376e90cb1a44fde056830/python-pptx-0.6.21.tar.gz Collecting rapidfuzz (from pptx2md) Using cached https://files.pythonhosted.org/packages/7f/51/e00e3b8e5fc0be5a3f5c320bbd75c9aead4b958221103a81471f847ca9b2/rapidfuzz-1.9.1.tar.gz Installing build dependencies ... error ERROR: Command errored out with exit status 2: command: /gnu/store/abznl1yzi6isa57mh1mj3fsdylksqd7m-python-3.8.2/bin/python3.8 /gnu/store/7xs29qssk1m7m13lk1lbr4ydj70nzj9c-profile/lib/python3.8/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-vrpr_vwo/overlay --no-warn-script-location --no-binary :all: --only-binary :none: -i https://pypi.org/simple -- setuptools wheel 'numpy==1.13.3; python_version=='"'"'2.7'"'"'' 'oldest-supported-numpy; python_version>='"'"'3.5'"'"'' cwd: None Complete output (28 lines): Ignoring numpy: markers 'python_version == "2.7"' don't match your environment Collecting setuptools Using cached https://files.pythonhosted.org/packages/80/d3/2954b9ac8ad256f352d941453c44d2d2b219aafeb95277e9282bef606329/setuptools-60.1.0.tar.gz Getting requirements to build wheel: started Getting requirements to build wheel: finished with status 'done' ERROR: Exception: Traceback (most recent call last): File "/gnu/store/7xs29qssk1m7m13lk1lbr4ydj70nzj9c-profile/lib/python3.8/site-packages/pip/_internal/cli/base_command.py", line 188, in main status = self.run(options, args) File "/gnu/store/7xs29qssk1m7m13lk1lbr4ydj70nzj9c-profile/lib/python3.8/site-packages/pip/_internal/commands/install.py", line 345, in run resolver.resolve(requirement_set) File "/gnu/store/7xs29qssk1m7m13lk1lbr4ydj70nzj9c-profile/lib/python3.8/site-packages/pip/_internal/legacy_resolve.py", line 196, in resolve self._resolve_one(requirement_set, req) File "/gnu/store/7xs29qssk1m7m13lk1lbr4ydj70nzj9c-profile/lib/python3.8/site-packages/pip/_internal/legacy_resolve.py", line 359, in _resolve_one abstract_dist = self._get_abstract_dist_for(req_to_install) File "/gnu/store/7xs29qssk1m7m13lk1lbr4ydj70nzj9c-profile/lib/python3.8/site-packages/pip/_internal/legacy_resolve.py", line 305, in _get_abstract_dist_for abstract_dist = self.preparer.prepare_linked_requirement( File "/gnu/store/7xs29qssk1m7m13lk1lbr4ydj70nzj9c-profile/lib/python3.8/site-packages/pip/_internal/operations/prepare.py", line 214, in prepare_linked_requirement abstract_dist.prepare_distribution_metadata( File "/gnu/store/7xs29qssk1m7m13lk1lbr4ydj70nzj9c-profile/lib/python3.8/site-packages/pip/_internal/distributions/source.py", line 70, in prepare_distribution_metadata reqs = self.req.pep517_backend.get_requires_for_build_wheel() File "/gnu/store/7xs29qssk1m7m13lk1lbr4ydj70nzj9c-profile/lib/python3.8/site-packages/pip/_vendor/pep517/wrappers.py", line 70, in get_requires_for_build_wheel return self._call_hook('get_requires_for_build_wheel', { File "/gnu/store/7xs29qssk1m7m13lk1lbr4ydj70nzj9c-profile/lib/python3.8/site-packages/pip/_vendor/pep517/wrappers.py", line 162, in _call_hook raise BackendUnavailable pip._vendor.pep517.wrappers.BackendUnavailable WARNING: You are using pip version 19.2.3, however version 21.3.1 is available. You should consider upgrading via the 'pip install --upgrade pip' command.
ERROR: Command errored out with exit status 2: /gnu/store/abznl1yzi6isa57mh1mj3fsdylksqd7m-python-3.8.2/bin/python3.8 /gnu/store/7xs29qssk1m7m13lk1lbr4ydj70nzj9c-profile/lib/python3.8/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-vrpr_vwo/overlay --no-warn-script-location --no-binary :all: --only-binary :none: -i https://pypi.org/simple -- setuptools wheel 'numpy==1.13.3; python_version=='"'"'2.7'"'"'' 'oldest-supported-numpy; python_version>='"'"'3.5'"'"'' Check the logs for full command output. ```
As you can see, it seems that somehow it is trying to use python 2.7
(in python_version=='"'"'2.7'"'"'"'
)
Thanks in advance
EDIT: I changed .envrc
to use guixs python python-pip
.
python-pip
includes the most recent version of pip3
(20.2.4)
Using this new pip3
I need to change the previous pip3 install
to:
pip3 install --prefix=$PREFIX_PATH pptx2md
And now everything is installed!
After the installation I need to update the PATH
and PYTHONPATH
environment variables as follows:
export PATH=$PREFIX_PATH/bin:$PATH export PYTHONPATH=$PREFIX_PATH/lib/python3.8/site-packages:$PYTHONPATH
(Note that you need to adjust the path to your python version)
Now, pptx2md
can be used from the command line:
pptx2md
and from the python shell:
```
import pptx2md ```
So everything works! (apparently)
When I try to actually use it I get:
$ pptx2md -o lecture_1.md Lecture1.pptx Traceback (most recent call last): File "/home/nanounanue/.python_guix/abznl1yzi6isa57mh1mj3fsdylksqd7m-python-3.8.2/bin/pptx2md", line 5, in <module> from pptx2md.__main__ import main File "/home/nanounanue/.python_guix/abznl1yzi6isa57mh1mj3fsdylksqd7m-python-3.8.2/lib/python3.8/site-packages/pptx2md/__main__.py", line 3, in <module> import pptx2md.outputter as outputter File "/home/nanounanue/.python_guix/abznl1yzi6isa57mh1mj3fsdylksqd7m-python-3.8.2/lib/python3.8/site-packages/pptx2md/outputter.py", line 1, in <module> from rapidfuzz import fuzz File "/home/nanounanue/.python_guix/abznl1yzi6isa57mh1mj3fsdylksqd7m-python-3.8.2/lib/python3.8/site-packages/rapidfuzz/__init__.py", line 8, in <module> from rapidfuzz import process, fuzz, utils, levenshtein, string_metric File "/home/nanounanue/.python_guix/abznl1yzi6isa57mh1mj3fsdylksqd7m-python-3.8.2/lib/python3.8/site-packages/rapidfuzz/process.py", line 4, in <module> from rapidfuzz.cpp_process import extract, extractOne, extract_iter ImportError: libstdc++.so.6: cannot open shared object file: No such file or directory
but I assume that I need to add that library (and potentially others) to the guix environment
EDIT 2:
I added the input (gcc ,gcc "lib")
which after reloading direnv
updated the LIBRARY_PATH
environment variable to point to a directory which has libstdc+I wonder if given that it compiled the library+.so.6
... but when I run
$ pptx2md -o lecture_1.md Lecture1.pptx
I got the same error as before, it seems that is not using LIBRARY_PATH
...
EDIT 3:
The environment variable needed is LD_LIBRARY_PATH
not LIBRARY_PATH
... if I set it to the same path the error disappears (but a new one shows up) How do I set up LD_LIBRAY_PATH
?