1

I am using Python in Jupyter Notebook. My Pandas version is

pandas: 0.23.4 

in which I cannot use Explode or other advanced functions. I am trying to upgrade it using the codes like:

!pip install -- upgrade pandas 

But keep receiving error messages like:

Could not fetch URL https://pypi.org/simple/ipython/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/ipython/ (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1045)'))) - skipping

Does anyone know how to rewrite the codes?

10
  • Can't you just write !pip install --upgrade pandas to only upgrade pandas? Commented Jun 28, 2022 at 14:45
  • 1
    try !{sys.executable} -m pip install ... Commented Jun 28, 2022 at 14:57
  • 1
    Still failed: Could not fetch URL pypi.org/simple/pip: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1045)'))) - skipping Directory '...' is not installable. File 'setup.py' not found. Commented Jun 28, 2022 at 15:00
  • 1
    This isn't going to help you with the connection/certificate issue; it's more a quality of life improvement in standard Jupyter. In your post you tried !pip install .... In the last couple of years a magic command was added that you should use when using pip in a notebook. %pip install ... will handle dealing with the environment backing your notebook, whereas the use of the exclamation point won't. A similar magic command was added for conda. See here for more information. Commented Jun 28, 2022 at 16:15
  • 1
    @Sandy we do realize that !pip install -- upgrade pandas isn't the same as !pip install --upgrade pandas right? In the first one you're trying to install upgrade and pandas, in the second you're upgrading pandas... Commented Jun 28, 2022 at 17:05

2 Answers 2

1

It might provide a temporary solution. I think there is a proxy or firewall rule restricting connection to pypi.org;

pip config set global.trusted-host "pypi.org files.pythonhosted.org pypi.python.org" --trusted-host=pypi.python.org --trusted-host=pypi.org --trusted-host=files.pythonhosted.org 
Sign up to request clarification or add additional context in comments.

Comments

0

I guess you need to provide more information about your setup, e.g., what operating system do you use. The call !pip install --upgrade pandas executes shell command. If, for instance, you use Ubuntu, then this command will try to install the pandas package using system package manager, and it will fail because you need sudo privileges.

It seems that you try to execute locally the code developed for the cloud collaborative platforms (e.g., Google Colab). Unfortunately, you need to do this carefully.

I would recommend to you to create a separate virtual environment for your project and install dependencies there. For instance, I use poetry to manage the dependencies in my projects but you can also use others (virtualenv, anaconda, pipenv, etc.).

4 Comments

Hi Yury, I am using Windows. I am not using Colab, this is just a Jupyter notebook in my local machine.
I think my comment below the OP about avoiding the exclamation point with pip and conda inside a Jupyter notebook cell complements the first paragraph of this answer.
Thanks @Wayne ! I did not know that a magic has been added to install packages. Still, I would recommend to use some Python package managers to install packages for a project.
Yes, using environments is still best for managing projects; however, the magic commands insuring things install to the environment backing your current notebook can sometimes more easily help you get past hurdles or test something quickly.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.