Unable to install python packages - Could not found suitable TLS certificate bundle - python-3.x

I am struggling to make Python (Anaconda) work from last few days. I had tried installing pytorch few days back and it crashed in between. Hence forth, my Anaconda is giving errors while installing any packages. I have Windows 10, 64 bit user with Python 3.6.1. - Intel chipset.
I am unable to install any package - above is the issue.
I even tried uninstalling and installing Anaconda which is the only Python distribution I have on my machine.
Another error which I receive -
Any help in this matter would be of great great help!!

Upgrade pip as follows:
curl https://bootstrap.pypa.io/get-pip.py | python
Note: You may need to use sudo python above if not in a virtual environment.
(Note that upgrading pip using pip i.e pip install --upgrade pip will also not upgrade it correctly. pip won't work unless using TLS >= 1.2.)
For PyCharm (virtualenv) users:
Run virtual environment with shell. (replace "./venv/bin/activate" to your own path)
source ./venv/bin/activate
Run upgrade
curl https://bootstrap.pypa.io/get-pip.py | python
Restart your PyCharm instance, and check your Python interpreter in Preference.

Related

How can I move from the default pre-installed Python 2.7 on my Mac to accessing Python 3.7 from Anaconda in Terminal?

I may be leaving out many details, but I'll attempt to construct the best picture of what is happening here.
My Mac is running OS Catalina 10.15.6, I got it back in April, and it has Python 2.7 in
I'm learning to use pip install and PyPI from terminal, and the first oddity I noticed was that I had to install pip. I shouldn't have, because it comes with Anaconda Navigator. So I did sudo easy-install pip and it installed. Then I did pip install requests which worked fine, then pip install colorama and then it threw this error message:
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: colorama in ./Library/Python/2.7/lib/python/site-packages (0.4.3)
My desire is to be able to use the Anaconda Python from terminal, since this 2.7 Python is dying and I need to be able to do so for my upcoming bootcamp and current Python course. I tried many conda commands to create an environment, see my current environment, etc, and they all failed because my terminal doesn't recognize conda as a command. I see this:
ryanlindsey#Ryans-MacBook-Pro ~ % conda info --envs
zsh: command not found: conda
ryanlindsey#Ryans-MacBook-Pro ~ % conda create -n myenv python=3.6
zsh: command not found: conda
ryanlindsey#Ryans-MacBook-Pro ~ % conda
zsh: command not found: conda
I've read stack overflow suggestions to add it to my path, but even when I use the code it seems to do nothing.
If this is useful, here is my PATH when I do echo $PATH
/Library/Frameworks/Python.framework/Versions/3.8/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin
My shell I am using is zsh.
Anyone experienced in solving problems like this?
MacOS comes with python 2.7 installed by default. You can't move or remove it. Catalina also comes with python 3.7 (though it requires the download of Xcode command line tools when first run to complete it.)
Usually, python 3 versions are instigated with the command python3. Similarly, pip3 manages libraries for python 3, while pip manages libraries for python 2.
It doesn't look like you've actually installed Anaconda. Anaconda is a third-party product, which does not come bundled with the OS. You'll need to install that and follow the instructions on their website.
https://docs.anaconda.com/anaconda/install/

How to fix EnvironmentError when installing modules using pip?

When trying to install requests or literally anything using pip it'll collect the option and then give me this ERROR every time. I can't use pip to install anything.
C:\Users\evand>pip3 install requests
Collecting requests
ERROR: Could not install packages due to an EnvironmentError: Could not find a suitable TLS CA certificate bundle, invalid path: path/to/ca-bundle.crt
Version of pip:
C:\Users\evand>pip --version
pip 19.2.3 from c:\users\evand\appdata\local\programs\python\python38-32\lib\site-packages\pip (python 3.8)
Version of Python:
C:\Users\evand>py --version
Python 3.8.3
Current Environment Variables (If this is related at all)
I have also tried the 'Repair' option using the Python Installer as well as uninstalling then reinstalling as a custom installation with 'Add to PATH' and the other options. That didn't fix the issue, so I deleted pip along with every module installed on my computer then reinstalled pip. Nada. At this point, I can no longer program with this computer because I cannot import any module in any of my scripts. I am not sure why this issue suddenly arose. Help would be very much appreciated.
This worked for me:
Uninstalling the pip configuration file in %appdata%/pip/ then 'modifying' python using the python launcher.

How to install tensorflow 1.15.0 in Ubuntu server 18.04

I am using Azure to create an Ubuntu server 18.04. The python3 default version in this VM is 3.6.9. I tried to install python3-pip, then install Tensorflow version 1.15.0 by command: sudo pip3 install Tensorflow==1.15.0.
However I got this error: No matching distribution found for tensorflow==1.15.0
I really don't know how to fix it. On my Windows PC, I got the same error while using python3.7, then I change to use python3.6.5 and everythings is fine. So that I think maybe I should try to install python 3.6.5 on Ubuntu VM. But again, this time, I can't install correctly python 3.6.5 on my Ubuntu server.
Can you please help me to fix it. I am just a newbie and honestly, I am not really good with Ubuntu.
Thank you so much.
I had the same issue.
A simple upgrade of pip to the latest version by:
sudo -H pip3 install --upgrade pip
sudo -H pip2 install --upgrade pip
solved the problem for me. Checkout https://askubuntu.com/questions/712339/how-to-upgrade-pip-to-latest for details how to upgrade pip.
After checking it seems the pip3 version shipped with Ubuntu defaults to pip 9.0.1. However, this version seems to supports only up to Tensorflow 1.14.
I would also strongly suggest to use virtual environments like Anaconda in order not to mess up your system python.
E.g.: https://docs.anaconda.com/anaconda/install/linux/
These are the list of files for TensorFlow 1.15
This command would work:
pip3 install tensorflow==1.15.0
I do see the manylinux wheel file for Ubuntu.
What CPU model and pip version are you using?
Debugging:
pip3 -v install tensorflow==1.15.0 | grep Found | more
Can help you see which platform and tags pip3 is trying to find in wheel files.
In the past I also have seen issue with pip default version (9.0.1), make sure you are running a recent version (e.g. pip-20.0.2):
apt install python3-pip && pip3 install --upgrade pip

Why virtualenv shows all packages installed and do not install modules in virtualenv?

Question
I am not sure why when virtualenv active, pip freeze stills showing all modules when it suppose NOT to. What am I doing wrong?
On the terminal
I tried two ways to create a virtual env:
virtualenv my-virtualenv
virtualenv --no-site-packages my-virtualenv
then activate it
source my-virtualenv/bin/activate
Results
Both show all packages (when they suppose not to). Running command pip freeze I get:
(my-virtualenv)$ pip freeze
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
actionlib==1.11.9
angles==1.9.11
bondpy==1.7.19
camera-calibration==1.12.20
camera-calibration-parsers==1.11.12
catkin==0.7.6
cv-bridge==1.12.4
diagnostic-analysis==1.9.2
diagnostic-common-diagnostics==1.9.2
diagnostic-updater==1.9.2
dynamic-reconfigure==1.5.48
gazebo-plugins==2.5.13
gazebo-ros==2.5.13
...
rosnode==1.12.7
rosparam==1.12.7
rospy==1.12.7
rosservice==1.12.7
rostest==1.12.7
rostopic==1.12.7
rosunit==1.13.5
roswtf==1.12.7
tf2-ros==0.5.16
topic-tools==1.12.7
xacro==1.11.2
Running
(my-virtualenv)$ which python
/home/user/.../my-virtualenv/bin/python
(my-virtualenv)$ python -V
Python 2.7.12
and
(my-virtualenv)$ which python3
/usr/bin/python3
(my-virtualenv)$ python3 -V
Python 3.5.2
Hence, I even can use python3 when virtualenv is activated but it uses the pc installed module. Moreover, new installed packages are install in the pc and not the virtualenv and I can't install python3 in the vitualenv because it "exists" already (but in the pc).
I was having the same issue and it was because, somehow, Python configuration of ROS was generating it.
I solved it removing the source commands of ROS from the ~/.bashrc. E.g.:
source /opt/ros/melodic/setup.bash
source $HOME/ROS/aslam_ws/devel/setup.bash
By the way, I realised that, before changing anything, creating the environment from PyCharm works properly too (when in the terminal I still had the issue).
There must be a better solution but I haven't found it yet.

Python 3.5.2 Windows x86-64 web-based, but installer not installing pip

I am trying to install TensorFlow. The installation instruction for Windows (https://www.tensorflow.org/install/install_windows) have as first step to install Python 3.5.2. And I'm doing the 'TensorFlow with CPU support only'.
Python was successfully installed in my computer as I can run it via the Start menu.
However, when I try to do the 2nd step of the installation instructions in order to install TensorFlow, this step says to:
To install TensorFlow, start a terminal. Then issue the appropriate pip3 install command in that terminal. To install the CPU-only version of TensorFlow, enter the following command:
C:\> pip3 install --upgrade tensorflow
But I'm getting an error when I perform the above statement, the error is
'pip' is not recognized as an internal or external command, oprable program or batch file.
I looked at several postings in StackOverflow and tried the commands provided in one of the postings, but I would get the same type of error.
So, how is 'pip3' installed? from what I read, it is supposed to be installed together with the installation, but obviously that did not happen.
How do I install it? I need to install TensorFlow and it seems that it needs to be done via the pip3 installation tool.
Thank you in advance for your help!
Either set the system environment path variable to include the python 3.5.x path in it, or just cd into the correct python folder to run pip3 from there.
The folder in windows 10 should be something like this:
C:\Users\YOUR_USERNAME\AppData\Local\Programs\Python\Python35\Scripts
Open the terminal, cd to that path (change YOUR_USERNAME to the correct user) and then just run the following command:
pip3 install --upgrade tensorflow
and if you want the gpu version:
pip3 install --upgrade tensorflow-gpu
Pip3 is already installed when you install Python, so there is no need to do anything else.

Resources