Re: [Tutor] pip stopped working gives error

2018-05-04 Thread Jim

On 05/03/2018 03:40 PM, Zachary Ware wrote:

On Thu, May 3, 2018 at 2:10 PM, Jim  wrote:

I have python 3.6 installed in a virtual environment on Mint 18. Today I
wanted to use pip and got this error when I tried to use it.

  (env36) jfb@jims-mint18 ~ $ pip help
Traceback (most recent call last):
   File "/home/jfb/EVs/env36/bin/pip", line 7, in 
 from pip import main
   File "/home/jfb/EVs/env36/lib/python3.6/site-packages/pip/__init__.py",
line 43, in 
 from pip.utils import get_installed_distributions, get_prog
   File
"/home/jfb/EVs/env36/lib/python3.6/site-packages/pip/utils/__init__.py",
line 23, in 
 from pip.locations import (
   File "/home/jfb/EVs/env36/lib/python3.6/site-packages/pip/locations.py",
line 9, in 
 from distutils import sysconfig
ImportError: cannot import name 'sysconfig'

I searched for sysconfig and found this:

/home/jfb/EVs/env36/lib/python3.6/site-packages/pip/_vendor/distlib/_backport/__pycache__/sysconfig.cpython-36.pyc
/home/jfb/EVs/env36/lib/python3.6/site-packages/pip/_vendor/distlib/_backport/sysconfig.cfg
/home/jfb/EVs/env36/lib/python3.6/site-packages/pip/_vendor/distlib/_backport/sysconfig.py

The results seem to be the same as when I searched a python 3.5 virtual
environment I have setup.

It has worked in the past as I have installed pylint and pykeyboard with it.
As I type this I just remembered Mint updated python 3.6 earlier today.

So now I suspect the update is involved. Has anyone else experienced this
and know how to fix it?


First, try a clean venv (python3.6 -m venv venv && ./venv/bin/pip help).


Ok, I just tried this and got this error.

jfb@jims-mint18 ~ $ python3.6 -m venv /home/jfb/EVs/env365 && 
./venv/bin/pip help
The virtual environment was not created successfully because ensurepip 
is not

available.  On Debian/Ubuntu systems, you need to install the python3-venv
package using the following command.

apt-get install python3-venv

You may need to use sudo with that command.  After installing the 
python3-venv

package, recreate your virtual environment.

Failing command: ['/home/jfb/EVs/env365/bin/python3.6', '-Im', 
'ensurepip', '--upgrade', '--default-pip']


Couple of things troubling about this message. I just checked and 
python3-venv is installed, in fact I used it to install the python3.6 
environment I'm having problems with. I did a search and ensurepip is on 
my system at //usr/lib/python3.6/ensurepip.


Regards,  Jim

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] pip stopped working gives error

2018-05-04 Thread Jim

On 05/03/2018 03:48 PM, Mats Wichmann wrote:

On 05/03/2018 02:27 PM, Jim wrote:


I heard distutils may have been split out... see if you have a package
python3-distutils and if not installed, can you install it?


I have:

//usr/lib/python3.5/distutils
and
//usr/lib/python3.6/distutils, but no python3-distutils.

Checking in Synaptic there is no python3-distutils but there is a
python3-distutils-extra.


it was a guess... this change seems to have just happened in Ubuntu
(bionic/18.04 only), perhaps that's not the thing affecting you in Mint
(yet).

$ dpkg -l python3-distutils
Desired=Unknown/Install/Remove/Purge/Hold
|
Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version
ArchitectureDescription
+++--===-===-=
ii  python3-distutils3.6.5-3 all
 distutils package for Python 3.x
$ dpkg -L python3 | grep sysconfig
$ dpkg -L python3-distutils | grep sysconfig
/usr/lib/python3.6/distutils/sysconfig.py
/usr/lib/python3.7/distutils/sysconfig.py
$


I don't know if I missed it or a late update pulled it in but I just did 
sudo apt install python3-distutils and now my problem is fixed.


Thanks to you and Zachary for helping me out.

Regards,  Jim


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor