Home > Blockchain >  Python Pycharm error while installing packages from pypi on Ubuntu
Python Pycharm error while installing packages from pypi on Ubuntu

Time:04-03

I don't know what to do. No package is able to install. I am on Ubuntu if it is of any relevance. First image shows my settings, selected interpreter first image

Here is what happens when I try to install (" " above Package) numpy. It is the same for any other package.

enter image description here

When I click on "Details" I get this command output:

Error: Traceback (most recent call last):
  File "/snap/pycharm-community/274/plugins/python-ce/helpers/packaging_tool.py", line 73, in run_pip
    runpy.run_module(module_name, run_name='__main__', alter_sys=True)
  File "/usr/lib/python3.8/runpy.py", line 207, in run_module
    return _run_module_code(code, init_globals, run_name, mod_spec)
  File "/usr/lib/python3.8/runpy.py", line 97, in _run_module_code
    _run_code(code, mod_globals, init_globals,
  File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/pestilene/Projects/Python/venv/lib/python3.8/site-packages/pip/__main__.py", line 29, in <module>
    from pip._internal.cli.main import main as _main
  File "/home/pestilene/Projects/Python/venv/lib/python3.8/site-packages/pip/_internal/cli/main.py", line 9, in <module>
    from pip._internal.cli.autocompletion import autocomplete
  File "/home/pestilene/Projects/Python/venv/lib/python3.8/site-packages/pip/_internal/cli/autocompletion.py", line 10, in <module>
    from pip._internal.cli.main_parser import create_main_parser
  File "/home/pestilene/Projects/Python/venv/lib/python3.8/site-packages/pip/_internal/cli/main_parser.py", line 8, in <module>
    from pip._internal.cli import cmdoptions
  File "/home/pestilene/Projects/Python/venv/lib/python3.8/site-packages/pip/_internal/cli/cmdoptions.py", line 23, in <module>
    from pip._internal.cli.parser import ConfigOptionParser
  File "/home/pestilene/Projects/Python/venv/lib/python3.8/site-packages/pip/_internal/cli/parser.py", line 12, in <module>
    from pip._internal.configuration import Configuration, ConfigurationError
  File "/home/pestilene/Projects/Python/venv/lib/python3.8/site-packages/pip/_internal/configuration.py", line 26, in <module>
    from pip._internal.utils.logging import getLogger
  File "/home/pestilene/Projects/Python/venv/lib/python3.8/site-packages/pip/_internal/utils/logging.py", line 13, in <module>
    from pip._internal.utils.misc import ensure_dir
  File "/home/pestilene/Projects/Python/venv/lib/python3.8/site-packages/pip/_internal/utils/misc.py", line 40, in <module>
    from pip._internal.locations import get_major_minor_version, site_packages, user_site
  File "/home/pestilene/Projects/Python/venv/lib/python3.8/site-packages/pip/_internal/locations/__init__.py", line 14, in <module>
    from . import _distutils, _sysconfig
  File "/home/pestilene/Projects/Python/venv/lib/python3.8/site-packages/pip/_internal/locations/_distutils.py", line 9, in <module>
    from distutils.cmd import Command as DistutilsCommand
ModuleNotFoundError: No module named 'distutils.cmd'

This is what is in my "Manage repositories"

enter image description here

I also tried installing directly from command line with no luck.

enter image description here

If anyone has any suggestions on how to solve this issue, I'd greatly appreciate it.

CodePudding user response:

Looks like the python3-distutils apt package is missing.

You can try installing it with sudo apt install python3-distutils

It might be necessary to recreate the venv afterwards. That should be possible through PyCharm.

  • Related