1

I'm running myself in circles with installs on python these days and I'm not sure why. My gut is telling me I'm installing my packages in some version of python and when I access them they're not being found because it's the wrong path. I'm using venv, python 3.6.5, MacOS. everything I try and install gets:

pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.

for everything I try and install. I've searched this and tried the fix of

pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org <<whateverpackage>>

no dice. I can get conda to work for installs, but then when I try and initialize in python I get module not found. This makes me think what is happening is that the tools are installing in a different path. which python result:

$ which python
/Users/myname/.pyenv/shims/python

when I ask for the packages installed I get different results as well:

pip list
DEPRECATION: The default format will switch to columns in the future. You can use --format=.   (legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning.
pip (9.0.3)
setuptools (39.0.1)

verses

conda list
# packages in environment at /anaconda3:
#
# Name                    Version                   Build  Channel

anaconda-client           1.7.2                    py37_0  
anaconda-navigator        1.9.12                   py37_0  
beautifulsoup4            4.9.1                    py37_0  

also ran:

$ brew update && brew upgrade

no change. I'm going nuts trying to figure out where I've lost the thread. this feels like a self created problem from venv, but at this point all the packages I install seem to work in conda but fail with pip, and neither function when I access python at the command line.

also, not sure if this will help: I started a virtual env in conda, same problem. my paths:

$echo $PATH
    /Users/username/.pyenv/shims:/Users/username/.pyenv/shims:/usr/local/Cellar/pyenv-virtualenv/1.1.5/shims:/Users/username/.pyenv/shims:/anaconda3/envs/venv/bin:/Users/username/miniconda3/bin:/Users/username/miniconda2/bin:/Users/username/anaconda3/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/username/Downloads/chromedriver:/opt/X11/bin

and

$echo $PYTHONPATH

returned nothing.

advice?

ike
  • 342
  • 3
  • 17
  • 3
    Python was compiled without SSL support. You have to fix that. Try `brew reinstall python` and recreate the environment. – Klaus D. Jul 29 '20 at 15:52
  • thank you @KlausD.; ran `brew reinstall python`; no dice. ran 'source deactivate' then pip, same result. – ike Jul 29 '20 at 17:12
  • 1
    You have to check the system Python. `import ssl` should do that. Then you have to recreate the environments (delete and create). – Klaus D. Jul 29 '20 at 19:28
  • You seem to be using both Conda and pyenv, could there be some conflicts there? – AMC Jul 29 '20 at 22:41
  • @AMC; as noted, I thought that initially as well, but as you can see below it was a certificate issue not a path issue. – ike Jul 29 '20 at 22:44
  • @ike Yes, I saw, I'm glad that worked. I should have clarified, I was just concerned about whether it could lead to further issues down the read. – AMC Jul 29 '20 at 22:51
  • yes, good flag, seems... likely, yes – ike Jul 29 '20 at 22:59

2 Answers2

2

so kudos to @KlausD for pointing me in the right direction. what ended up being the case is in fact that we were missing the ssl. I found this post that suggested I might benefit from running a new brew install of the ssl.

I ran:

  brew switch openssl 1.0.2t

and that was it, everything worked after that! three days of beating my head against the wall and here we are....

ike
  • 342
  • 3
  • 17
1

The openssl/pyopenssl/python/pip version match was the issue in my case as well. I ended up on the https://www.pyopenssl.org/en/stable/install.html page and used python -m OpenSSL.debug to find out the versions of pyOpenSSL, cryptography, and the linked OpenSSL.

obotezat
  • 1,041
  • 16
  • 20