1 line
10 KiB
Plaintext
1 line
10 KiB
Plaintext
<!-- SC_OFF --><div class="md"><p>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 <code>pip3</code>. I am following this set of notes: <a href="https://github.com/pjotrp/guix-notes/blob/master/PYTHON.org#isolated-module-installation">https://github.com/pjotrp/guix-notes/blob/master/PYTHON.org#isolated-module-installation</a> and <code>direnv</code> (following the excellent tropin's video (<a href="https://www.youtube.com/watch?v=GzzxTT1uU-M">https://www.youtube.com/watch?v=GzzxTT1uU-M</a>) </p> <p>So my setup is:</p> <p><code>.envrc</code>:</p> <p>``` use guixs python</p> <p>PYTHONBIN=$(readlink -f <code>which python3</code>) PYTHONHASH=$(basename $(dirname $(dirname $PYTHONBIN))) echo $PYTHONHASH export PREFIX_PATH=$HOME/.python_guix/$PYTHONHASH ```</p> <p>After running <code>ddirenv allow</code> I got:</p> <p><code> $ which python3 /gnu/store/7xs29qssk1m7m13lk1lbr4ydj70nzj9c-profile/bin/python3 </code></p> <p><code> $ which pip3 /gnu/store/7xs29qssk1m7m13lk1lbr4ydj70nzj9c-profile/bin/pip3 </code></p> <p><code> $ echo $PREFIX_PATH /home/nanounanue/.python_guix/abznl1yzi6isa57mh1mj3fsdylksqd7m-python-3.8.2 </code></p> <p>So everything seems fine. So, I run:</p> <p><code> $ pip3 install --install-option="--prefix='$PREFIX_PATH'" pptx2md </code></p> <p>I got a nasty error:</p> <p>``` /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 <a href="https://files.pythonhosted.org/packages/db/10/2cd214da27344f033e1d5b93baad4389963feb620e11d864005a49e6d70c/pptx2md-1.1.1.tar.gz">https://files.pythonhosted.org/packages/db/10/2cd214da27344f033e1d5b93baad4389963feb620e11d864005a49e6d70c/pptx2md-1.1.1.tar.gz</a> Collecting python-pptx (from pptx2md) Using cached <a href="https://files.pythonhosted.org/packages/eb/c3/bd8f2316a790291ef5aa5225c740fa60e2cf754376e90cb1a44fde056830/python-pptx-0.6.21.tar.gz">https://files.pythonhosted.org/packages/eb/c3/bd8f2316a790291ef5aa5225c740fa60e2cf754376e90cb1a44fde056830/python-pptx-0.6.21.tar.gz</a> Collecting rapidfuzz (from pptx2md) Using cached <a href="https://files.pythonhosted.org/packages/7f/51/e00e3b8e5fc0be5a3f5c320bbd75c9aead4b958221103a81471f847ca9b2/rapidfuzz-1.9.1.tar.gz">https://files.pythonhosted.org/packages/7f/51/e00e3b8e5fc0be5a3f5c320bbd75c9aead4b958221103a81471f847ca9b2/rapidfuzz-1.9.1.tar.gz</a> 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 <a href="https://pypi.org/simple">https://pypi.org/simple</a> -- 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 <a href="https://files.pythonhosted.org/packages/80/d3/2954b9ac8ad256f352d941453c44d2d2b219aafeb95277e9282bef606329/setuptools-60.1.0.tar.gz">https://files.pythonhosted.org/packages/80/d3/2954b9ac8ad256f352d941453c44d2d2b219aafeb95277e9282bef606329/setuptools-60.1.0.tar.gz</a> 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.</p> <hr/> <p>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 <a href="https://pypi.org/simple">https://pypi.org/simple</a> -- setuptools wheel 'numpy==1.13.3; python_version=='"'"'2.7'"'"'' 'oldest-supported-numpy; python_version>='"'"'3.5'"'"'' Check the logs for full command output. ```</p> <p>As you can see, it seems that somehow it is trying to use <code>python 2.7</code> (in <code>python_version=='"'"'2.7'"'"'"'</code>)</p> <p>Thanks in advance</p> <p><em>EDIT</em>: I changed <code>.envrc</code> to <code>use guixs python python-pip</code>.</p> <p><code>python-pip</code> includes the most recent version of <code>pip3</code> (20.2.4)</p> <p>Using this new <code>pip3</code> I need to change the previous <code>pip3 install</code> to:</p> <p><code> pip3 install --prefix=$PREFIX_PATH pptx2md </code></p> <p>And now everything is installed!</p> <p>After the installation I need to update the <code>PATH</code> and <code>PYTHONPATH</code> environment variables as follows:</p> <p><code> export PATH=$PREFIX_PATH/bin:$PATH export PYTHONPATH=$PREFIX_PATH/lib/python3.8/site-packages:$PYTHONPATH </code></p> <p>(Note that you need to adjust the path to your python version)</p> <p>Now, <code>pptx2md</code> can be used from the command line:</p> <p><code> pptx2md </code></p> <p>and from the python shell:</p> <p>```</p> <blockquote> <blockquote> <blockquote> <p>import pptx2md ```</p> </blockquote> </blockquote> </blockquote> <p>So everything works! (apparently)</p> <p>When I try to actually use it I get:</p> <p><code> $ 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 </code></p> <p>but I assume that I need to add that library (and potentially others) to the <code>guix environment</code></p> <p><em>EDIT 2</em>:</p> <p>I added the input <code>(gcc ,gcc "lib")</code> which after reloading <code>direnv</code> updated the <code>LIBRARY_PATH</code> environment variable to point to a directory which has <code>libstdc+I wonder if given that it compiled the library+.so.6</code>... but when I run </p> <p><code> $ pptx2md -o lecture_1.md Lecture1.pptx </code></p> <p>I got the same error as before, it seems that is not using <code>LIBRARY_PATH</code>...</p> <p><em>EDIT 3</em>:</p> <p>The environment variable needed is <code>LD_LIBRARY_PATH</code> not <code>LIBRARY_PATH</code> ... if I set it to the same path the error disappears (but a new one shows up) How do I set up <code>LD_LIBRAY_PATH</code>?</p> </div><!-- SC_ON -->   submitted by   <a href="https://www.reddit.com/user/nanounanue"> /u/nanounanue </a> <br/> <span><a href="https://www.reddit.com/r/GUIX/comments/rqinrg/another_iteration_python_environment/">[link]</a></span>   <span><a href="https://www.reddit.com/r/GUIX/comments/rqinrg/another_iteration_python_environment/">[comments]</a></span> |