2
votes

I'd like to be able to document how to add a package to a VirtualEnv under Python 3.6 in PyCharm.

“Unable to locate finder for 'pip._vendor.distlib'” error when using "pip install virtualenv" , for one example, articulates what appears to be the same basic issue, a known issue with current PyCharm, resolved by command line commands.

I like the LUM CLI and it is like a native language to me, but I am trying to document things clearly for developers who may or may not be comfortable with any Unix-like CLI, and the instructions in the question above ask people to resolve the matter through the CLI.

Is there any way either to fix the Pip issues from within PyCharm as IDE, or to attach a project to a VirtualEnv and install a package represented on PyPI?

The error message I'm getting (for the curious) is:

Collecting bleach
  Downloading bleach-2.0.0-py2.py3-none-any.whl
Collecting html5lib>=0.99999999 (from bleach)
  Downloading html5lib-0.999999999-py2.py3-none-any.whl (112kB)
Collecting six (from bleach)
  Downloading six-1.10.0-py2.py3-none-any.whl
Collecting setuptools>=18.5 (from html5lib>=0.99999999->bleach)
  Downloading setuptools-34.3.2-py2.py3-none-any.whl (389kB)
Collecting webencodings (from html5lib>=0.99999999->bleach)
  Downloading webencodings-0.5.tar.gz
Collecting appdirs>=1.4.0 (from setuptools>=18.5->html5lib>=0.99999999->bleach)
  Downloading appdirs-1.4.3-py2.py3-none-any.whl
Collecting packaging>=16.8 (from setuptools>=18.5->html5lib>=0.99999999->bleach)
  Downloading packaging-16.8-py2.py3-none-any.whl
Collecting pyparsing (from packaging>=16.8->setuptools>=18.5->html5lib>=0.99999999->bleach)
  Downloading pyparsing-2.2.0-py2.py3-none-any.whl (56kB)
Installing collected packages: six, appdirs, pyparsing, packaging, setuptools, webencodings, html5lib, bleach
  Found existing installation: setuptools 18.1
    Uninstalling setuptools-18.1:
      Successfully uninstalled setuptools-18.1
  Rolling back uninstall of setuptools

You are using pip version 7.1.0, however version 9.0.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
Exception:
Traceback (most recent call last):
  File "C:\Users\CJSHa\cardshopenv\lib\site-packages\pip-7.1.0-py3.6.egg\pip\basecommand.py", line 223, in main
    status = self.run(options, args)
  File "C:\Users\CJSHa\cardshopenv\lib\site-packages\pip-7.1.0-py3.6.egg\pip\commands\install.py", line 299, in run
    root=options.root_path,
  File "C:\Users\CJSHa\cardshopenv\lib\site-packages\pip-7.1.0-py3.6.egg\pip\req\req_set.py", line 646, in install
    **kwargs
  File "C:\Users\CJSHa\cardshopenv\lib\site-packages\pip-7.1.0-py3.6.egg\pip\req\req_install.py", line 813, in install
    self.move_wheel_files(self.source_dir, root=root)
  File "C:\Users\CJSHa\cardshopenv\lib\site-packages\pip-7.1.0-py3.6.egg\pip\req\req_install.py", line 1008, in move_wheel_files
    isolated=self.isolated,
  File "C:\Users\CJSHa\cardshopenv\lib\site-packages\pip-7.1.0-py3.6.egg\pip\wheel.py", line 465, in move_wheel_files
    generated.extend(maker.make(spec))
  File "C:\Users\CJSHa\cardshopenv\lib\site-packages\pip-7.1.0-py3.6.egg\pip\_vendor\distlib\scripts.py", line 323, in make
    self._make_script(entry, filenames, options=options)
  File "C:\Users\CJSHa\cardshopenv\lib\site-packages\pip-7.1.0-py3.6.egg\pip\_vendor\distlib\scripts.py", line 227, in _make_script
    self._write_script(scriptnames, shebang, script, filenames, ext)
  File "C:\Users\CJSHa\cardshopenv\lib\site-packages\pip-7.1.0-py3.6.egg\pip\_vendor\distlib\scripts.py", line 163, in _write_script
    launcher = self._get_launcher('t')
  File "C:\Users\CJSHa\cardshopenv\lib\site-packages\pip-7.1.0-py3.6.egg\pip\_vendor\distlib\scripts.py", line 302, in _get_launcher
    result = finder(distlib_package).find(name).bytes
  File "C:\Users\CJSHa\cardshopenv\lib\site-packages\pip-7.1.0-py3.6.egg\pip\_vendor\distlib\resources.py", line 297, in finder
    raise DistlibException('Unable to locate finder for %r' % package)
pip._vendor.distlib.DistlibException: Unable to locate finder for 'pip._vendor.distlib'

1
@AbijithMg, I am specifically looking for a way of fixing the issue from within the PyCharm IDE. I'm working on documentation and would prefer not to say, "And for this step, we pull up a command line window..." The article you referenced, suggests an implementation that goes behind the IDE's back and uses command line too.s - Christos Hayward
If you are using pycharm professional edition then you can ask the tech support team the same question. That will be the ideal location to get a spot on answer. - Abijith Mg
mmm.... What is LUM? - Udi
Linux / Unix / Mac - Christos Hayward

1 Answers

0
votes

From PyCharm docs, regarding pip:

PyCharm provides a dedicated tool for installing, uninstalling, and upgrading Python packages. So doing, if a packaging tool is missing, PyCharm suggests to install it.

And regarding virtualenv:

PyCharm makes it possible create virtual environment using the virtualenv tool. So doing, PyCharm tightly integrates with virtualenv, and enables configuring virtual environments right in the IDE.