#๐Ÿ”’ Error Occured while trying install a package in virtualenv.

57 messages ยท Page 1 of 1 (latest)

rough driftBOT
#

@cunning reef

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

cunning reef
#

My Path says:

export PATH=/Library/Frameworks/Python.framework/Versions/3.13/bin:$PATH

When i follow through and actually look at where the PATH ends up, here is what I get:

Inheritanc-e Frameworks %:ls
CoreRepairCore.framework    CoreRepairKit.framework        Python.framework        iTunesLibrary.framework
Inheritanc-e Frameworks %:cd Python.framework 
Inheritanc-e Python.framework %:ls
Headers        Python        Resources    Versions
Inheritanc-e Python.framework %:cd Versions 
Inheritanc-e Versions %:ls
3.10    3.12    3.13    3.8    3.9    Current
Inheritanc-e Versions %:cd ..
Inheritanc-e Python.framework %:cd Python 
cd: not a directory: Python
Inheritanc-e Python.framework %:ls
Headers        Python        Resources    Versions
Inheritanc-e Python.framework %:cd Versions 
Inheritanc-e Versions %:lw
zsh: command not found: lw
Inheritanc-e Versions %:ls
3.10    3.12    3.13    3.8    3.9    Current
Inheritanc-e Versions %:
#

I also got another error here,

โœ” Successfully created virtual environment! 
Failed to load paths: Traceback (most recent call last):
  File "<string>", line 1, in <module>
    import sysconfig, distutils.sysconfig, io, json, sys; paths = {u'purelib': u'{0}'.format(distutils.sysconfig.get_python_lib(plat_specific=0)),u'stdlib': u'{0}'.format(sysconfig.get_path('stdlib')),u'platlib': u'{0}'.format(distutils.sysconfig.get_python_lib(plat_specific=1)),u'platstdlib': u'{0}'.format(sysconfig.get_path('platstdlib')),u'include': u'{0}'.format(distutils.sysconfig.get_python_inc(plat_specific=0)),u'platinclude': u'{0}'.format(distutils.sysconfig.get_python_inc(plat_specific=1)),u'scripts': u'{0}'.format(sysconfig.get_path('scripts')),u'py_version_short': u'{0}'.format(distutils.sysconfig.get_python_version()), }; value = u'{0}'.format(json.dumps(paths));fh = io.open('/var/folders/d8/7dcs21954fv5y4fc9dt96k_w0000gn/T/tmpbba_ev57.json', 'w'); fh.write(value); fh.close()
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ModuleNotFoundError: No module named 'distutils'
rustic totem
#

i can't say exactly what's going on, but i know distutils was removed from the standard library in 3.12+

#

usage of distutils.sysconfig was apparently removed since pipenv's 2022.8.5 release

cunning reef
#

oo

#

hmm, is it too early to use 3.13?

rustic totem
#

but judging from your earlier traceback i assume you have the latest version already, 2024.2.0

cunning reef
#

ye pretty sure, and now because of "no module named distutils" pipenv isn't actually installing other modules as well

#
Error:  An error occurred while installing pyside6!
Error text: 
Traceback (most recent call last):
  File "/Users/inheritanc-e/.local/share/virtualenvs/qt6-GxBq9NXW/bin/pip", line 5, in <module>
    from pip._internal.cli.main import main
  File "/Users/inheritanc-e/.local/share/virtualenvs/qt6-GxBq9NXW/lib/python3.13/site-packages/pip/_internal/cli/main.py", line 10, in <module>
    from pip._internal.cli.autocompletion import autocomplete
  File "/Users/inheritanc-e/.local/share/virtualenvs/qt6-GxBq9NXW/lib/python3.13/site-packages/pip/_internal/cli/autocompletion.py", line 9, in <module>
    from pip._internal.cli.main_parser import create_main_parser
  File "/Users/inheritanc-e/.local/share/virtualenvs/qt6-GxBq9NXW/lib/python3.13/site-packages/pip/_internal/cli/main_parser.py", line 7, in <module>
    from pip._internal.cli import cmdoptions
  File "/Users/inheritanc-e/.local/share/virtualenvs/qt6-GxBq9NXW/lib/python3.13/site-packages/pip/_internal/cli/cmdoptions.py", line 18, in <module>
    from distutils.util import strtobool
ModuleNotFoundError: No module named 'distutils'

โœ˜ Installation Failed 
rustic totem
#

in that case, pip is probably out of date

cunning reef
#
Inheritanc-e qt6 %:python3 -m pip --version
pip 24.2 from /Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/pip (python 3.13)

i don't think it is

rustic totem
rough driftBOT
#

src/pip/_internal/cli/cmdoptions.py line 18

from distutils.util import strtobool```
rustic totem
cunning reef
#
(qt6) Inheritanc-e qt6 %:pipenv run python3 -m pip --version
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/Users/inheritanc-e/.local/share/virtualenvs/qt6-GxBq9NXW/lib/python3.13/site-packages/pip/__main__.py", line 23, in <module>
    from pip._internal.cli.main import main as _main  # isort:skip # noqa
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/inheritanc-e/.local/share/virtualenvs/qt6-GxBq9NXW/lib/python3.13/site-packages/pip/_internal/cli/main.py", line 10, in <module>
    from pip._internal.cli.autocompletion import autocomplete
  File "/Users/inheritanc-e/.local/share/virtualenvs/qt6-GxBq9NXW/lib/python3.13/site-packages/pip/_internal/cli/autocompletion.py", line 9, in <module>
    from pip._internal.cli.main_parser import create_main_parser
  File "/Users/inheritanc-e/.local/share/virtualenvs/qt6-GxBq9NXW/lib/python3.13/site-packages/pip/_internal/cli/main_parser.py", line 7, in <module>
    from pip._internal.cli import cmdoptions
  File "/Users/inheritanc-e/.local/share/virtualenvs/qt6-GxBq9NXW/lib/python3.13/site-packages/pip/_internal/cli/cmdoptions.py", line 18, in <module>
    from distutils.util import strtobool
ModuleNotFoundError: No module named 'distutils'
#

this is what I got while trying to check the pip in the venv

rustic totem
#

how does pipenv normally upgrade pip?

cunning reef
#

wdym?

rustic totem
#

when i use the virtualenv tool, it has a --upgrade-embed-wheels option that updates the default packages included in new virtual environments i create, i.e. pip, setuptools, and sometimes wheel

#

does pipenv have something similar? the errors would suggest the version of pip included in their virtual environments is <21.0

cunning reef
#

should I use it?

rustic totem
#

hmm, is it possible for you to use ensurepip to upgrade it? as in: sh pipenv run python3 -m ensurepip --upgrade

rustic totem
cunning reef
#

I don't think pipenv will run any command at all, cause of distills

rustic totem
#

wait, your venv has virtualenv installed inside it?

cunning reef
#

no i meant my global venv

rustic totem
#

ah okay

cunning reef
# rustic totem hmm, is it possible for you to use ensurepip to upgrade it? as in: ```sh pipenv ...

I did run this,

Inheritanc-e qt6 %:pipenv run python3 -m ensurepip --upgrade
Looking in links: /var/folders/d8/7dcs21954fv5y4fc9dt96k_w0000gn/T/tmpgl1_qznb
Requirement already satisfied: pip in /Users/inheritanc-e/.local/share/virtualenvs/qt6-GxBq9NXW/lib/python3.13/site-packages (20.2.4)
Processing /var/folders/d8/7dcs21954fv5y4fc9dt96k_w0000gn/T/tmpgl1_qznb/pip-24.2-py3-none-any.whl
Installing collected packages: pip
  Attempting uninstall: pip
    Found existing installation: pip 20.2.4
    Uninstalling pip-20.2.4:
      Successfully uninstalled pip-20.2.4
Successfully installed pip-24.2
rustic totem
#

yup, older than 21.0

#

try installing packages now

cunning reef
#

aight

rustic totem
cunning reef
#

its taking a while

rustic totem
#

oh right, pipenv is still invoking distutils...

#

does pipenv have a command to check its own version?

cunning reef
#

ye

rustic totem
#

i'd assume pipenv -V or pipenv --version, but their docs don't show what options are available

cunning reef
#
Inheritanc-e ~ %:pipenv --version
pipenv, version 2020.11.15
#

this is globally

rustic totem
#

oh ye that's way out of date

rustic totem
#

the first release of 3.12, when distutils was removed from stdlib, was in october of 2023

cunning reef
#

lol, i haven't used python in a while that's why

#

leme upgrade pipenv

#
Installing collected packages: pipenv
Successfully installed pipenv-2024.2.0
rustic totem
#

as well, distutils was first deprecated by PEP 632 when python 3.10 released in 2021, so pipenv couldn't have predicted its removal back in 2020

cunning reef
#

I see. Now it's just the pipfile locking process which is taking a while.

#

Thanks for the help btw @rustic totem. you mind if i keep this open till the process is completely done?

rustic totem
#

no worries

cunning reef
#
Installing dependencies from Pipfile.lock (97e60a)...
All dependencies are now up-to-date!
Installing dependencies from Pipfile.lock (97e60a)...
(qt6) Inheritanc-e qt6 %:

Thanks man

#

!close

rough driftBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.