“ssl module in Python is not available” when installing package with pip3

后端 未结 28 1444
别跟我提以往
别跟我提以往 2020-11-22 08:51

I\'ve install Python 3.4 and Python 3.6 on my local machine successfully, but am unable to install packages with pip3.

When I execute pip3 install

28条回答
  •  名媛妹妹
    2020-11-22 09:25

    (NOT on Windows!)

    This made me tear my hair out for a week, so I hope this will help someone

    I tried everything short of re-installing Anaconda and/or Jupyter.

    Setup

    • AWS Linux
    • Manually installed Anaconda 3-5.3.0
    • Python3 (3.7) was running inside anaconda (ie, ./anaconda3/bin/python)
    • there was also /usr/bin/python and /usr/bin/python3 (but these were not being used as most of the work was done in Jupyter's terminal)

    Fix

    In Jupyter's terminal:

    cp /usr/lib64/libssl.so.10 ./anaconda3/lib/libssl.so.1.0.0

    cp /usr/lib64/libcrypto.so.10 ./anaconda3/lib/libcrypto.so.1.0.0

    What triggered this?

    So, this was all working until I tried to do a conda install conda-forge

    I'm not sure what happened, but conda must have updated openssl on the box (I'm guessing) so after this, everything broke.

    Basically, unknown to me, conda had updated openssl, but somehow deleted the old libraries and replaced it with libssl.so.1.1 and libcrypto.so.1.1.

    Python3, I guess, was compiled to look for libssl.so.1.0.0

    In the end, the key to diagnosis was this:

    python -c "import ssl; print (ssl.OPENSSL_VERSION)"

    gave the clue library "libssl.so.1.0.0" not found

    The huge assumption I made is that the yum version of ssl is the same as the conda version, so just renaming the shared object might work, and it did.

    My other solution was to re-compile python, re-install anaconda, etc, but in the end I'm glad I didn't need to.

    Hope this helps you guys out.

提交回复
热议问题