!pip not installing packages as expected
See original GitHub issueI recently installed Python 3.9.6 from python.org and tried to run notebook against this interpreter but ran into a couple of issues.
Problem
- Install Python 3.9.6, which was not added to the PATH
- Open a notebook, Python 3.9.6 is listed in kernel list, select this kernel
- Run
import pandas as pd
, it prompts to ask to install ipykernel - After ipykernel is installed, rerun the cell, we get error “pandas is missing”
- Insert a new cell, run
!pip install pandas
, it works but it installs the pandas package topython 2.7
as that the interpreter in the PATH
Proposal
The underling problem is the disconnect between Python active interpreter, Jupyter kernel, and the python interpreter in the PATH. If users are using pyenv, venv, or conda, the extension will activate the environment, which will set up the environment properly, however we don’t have such thing for the vanilla Python interpreter.
We should probably
- Show a warning for
!pip
if thepip
in the PATH is not the one in the interpreter behind the selected kernel - Automatically add the
pip
from the interpreter of the selected kernel to the PATH temporarily
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (7 by maintainers)
Top Results From Across the Web
Pip Install not installing into correct directory? - Stack Overflow
From the comments to the original question, it seems that you have multiple versions of python installed and that pip just goes to...
Read more >pip not installing packages as expected · Issue #6864 - GitHub
I recently installed Python 3.9.6 from python.org and tried to run notebook against this interpreter but ran into a couple of issues.
Read more >Installing Packages - Python Packaging User Guide - Python.org
Run python get-pip.py . 2 This will install or upgrade pip. Additionally, it will install setuptools and wheel if they're not installed already....
Read more >How to install and use Pip3 - ActiveState
Install Pip3. pip3 is the official package manager and pip command for Python 3. It enables the installation and management of third party ......
Read more >Pip Command Not Found on Windows: A Guide | Built In
A “pip: command not found” error occurs when you fail to properly install the package installer for Python (pip) needed to run Python...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Personally I think we should put up an error if the user has !pip or !conda as they don’t do what the user expects.
Suggestion:
!pip
and recommend using%pip
or%conda
if its a conda environment.