I successfully installed ipython via pip. I wanted then to use it by launching it through windows 10 command prompt but am getting the following error
'ipython' is not recognized as an internal or external command,
operable program or batch file.
I have gone through many questions on stackoverflow but cannot get a relevant solution.
I tried pip install ipython to confirm the ipython is installed and following on the instruction on my tutorial, i typed ipython on cmd to launch the program and it has never worked. This is slowing down my learning, please help!
Found the solution: run python -m IPython (case sensitive).
To find that out, I ran pip show ipython and it showed me some info, including the path of the module (for me: c:\users\mathieures\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packages). In there, a folder named IPython!
Search in your machine the ipython application (directory in which it is installled) and the add the path to PATH environment variables.
For example in my case location was C:\Users\DELL\AppData\Local\Programs\Python\Python37\Scripts
Add this path to PATH environment variable (see here) and your problem is solved.
for first uninstall ipython python -m pip uninstall ipython then install ipython with code python -m pip install ipython when finished type ipython to run.
I had the same problem, and what i simply did is uninstall it using pip uninstall ipython and then reinstall it using pip install ipython like the same as what Ali vatankhah did but without adding python -m in the command.
Related
I have downloaded and installed python from here.
Then I restarted and opened a commandline and typed
python --version
I recorded all my actions, so I can post a screenshot of that:
It works and shows the version number.
Then I performed the following steps to install Jupyter because I want to use a local runtime with Google Colab:
In the Windows commandline (not in the Python window!!), I type this:
pip install virtualenv
python -m pip install --upgrade pip
virtualenv opencv (I guess I can choose a random name here because we will not be using OpenCV, right? But for simplicity, I keep this name now)
I CD to c:\users\MYUSERNAME\opencv\Scripts
activate.bat
pip install numpy
python -m pip install jupyter
Now my browser opens this page: http://localhost:8888/tree
Now I click "New" and "Python 3 (ipykernel)"
Now I want to install the extension jupyter_http_over_ws.
I type:
pip install jupyter_http_over_ws
Nothing shows up when I type text on the keyboard. It looks like this:
Because I want to be able to type again, I close the command line and open it again.
Now I type again:
pip install jupyter_over_http_ws
It says
The command "pip" has been misspelt oder was not found.
Because I have no idea what is happening, I type:
python --version
I am expecting that it shows the version number like before.
But instead it shows
"Python was not found."
Why is that?
ps: When I type "python", it starts the Microsoft App Store and offers me to download it:
Thank you!
What happens if you add your python installation path to the environment variables?
https://www.educative.io/answers/how-to-add-python-to-path-variable-in-windows
Don't forget to restart Windows after adding the path!
Inside my pycharm package section pip (v:21.3.1) is showing as installed but when running pip commands it shows following error
pip : The term 'pip' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was
included, verify that the path is correct and try again.
use !pip that might help. Else, try to see pip list and uninstall the package and try uninstalling using '!pip', this takes directly outside the main terminal.
My guess is that you are not inside the Pycharm virtual environment.
Try to go to the terminal/command line and go to the project directory,
you should look for 'venv' directory.
Than activate the virtual enviorment.
terminal:
source /venv/Scripts/activate (run activate.sh file)
command line
call /venv/Scripts/activate (run activate.bat file)
and then you will be able to run pip
Solution 1:
Install packages within pycharm & run the code within pycharm
Solution 2:
Find python.exe in the install directonary, open cmd in the folder and run following:
python.exe -m pip install ...
Solution 3:
activate the venv (you can find instructions on google or use the one from the dude above)
This might help
python -m pip install <package name>
Different solutions to this problem:
First: you are not on the pycharm terminal but on the power-shell terminal
(if so, use the drop-down menu to the right of the +)
edit: if you opened the file/folder without creating a project, pip won't work in it (using a virtual env anyway)
Second : you have a python3 environment
(use pip3 instead)
Last : your path is badly configured (not a big problem, passing by python -m pip ... it will work (or python3 or other version installed))
Finally, except in very specific cases
file->setting->python Interpreter allows you to install anything you want without command line
Hoping to have helped you ;}
I've tried severally to install Pandas-Profiling on my windows 10 cmd using "pip install pandas-profiling" but it doesn't work. I've also tried installing it on conda but its the same story. I need help installing this please.
I also had the same problem. It didn't work with a normal pip install. I fixed it by running the following command in anaconda prompt:
conda install -c anaconda pandas-profiling
You can find the full documentation here.
Hope it helps :)
if you don't provide the error message, we can't help you.
If you have the following error message:
'pip' is not recognized as an internal or external command,
operable program or batch file.
It means that Python is not added to your Path environment variable. How to fix it:
First solution: Adding Python to the Path by going in your environment variables, in System Variables click on Path then Edit, and in the grid, add your Python's path (which may be C:\Users\<user>\AppData\Local\Programs\Python\Python<version>\). You can also add Python yo the Path by uninstall it and install it again and in the installer, make sure you check "Add Python to PATH"
Second solution: You can run pip by putting python3 -m before you pip command, like that: python3 -m pip install pandas-profiling.
I have been able to find a solution to the error message. I had to install the Microsoft C++ Build Tools, then I launched it and did the installation through it using ‘pip install pandas-profiling’ you can download using the link https://visualstudio.microsoft.com/visual-cpp-build-tools/
For me it only works also if putting "py"
so:
py -m pip install pandas-profiling
In the command prompt.
I just updated my macOS to Catalina and I can't run python or open a jupyter notebook from terminal anymore. As an example, I get error message "ImportError: No module named pandas" when running my python code, and I get
zsh: command not found: jupyter
when running
jupyter notebook
This issue has brought me to anaconda (I would love someone to explain me why. Does python need anaconda to be ran?). I have tried several suggestions from https://github.com/ContinuumIO/anaconda-issues/issues/10998, e.g. I have tried copying folder "anaconda3" from "Relocated items" folder to "Users//", then
export PATH=''/Users/<username>/anaconda3/bin:$PATH"
but I get either
dquote>
or
zsh: /Users//Applications/anaconda3/bin/conda: bad interpreter: /anaconda3/bin/python: no such file or directory
I then tried to reinstall Anaconda using the graphic installer (from https://www.anaconda.com/distribution/#macos) following advice from someone from the anaconda team (https://www.anaconda.com/how-to-restore-anaconda-after-macos-catalina-update/) (I changed installation location to a folder I created in /Users//) but I still get the same error messages when running python3 or jupyter notebook.
How can successfully run python and jupyter notebook with macOS Catalina?
After installed macOS Catalina, we can switch the terminal from bash to zsh. There are many advantages from using zsh instead of bash, but One of the issues with zsh is some of the frameworks (jupyter notebook,conda) are not supported directly. Once I typed jupyter notebook in terminal to run it. It displayed “zsh: no such file or directory”.
The solver is simple but very difficult to find online.
If jupyter was already installed before the update and stopped working after zsh, you should be able to fix it by:
1.open zshrc in terminal by typing: open .zshrc or $open .zschrc
2. add the following line at the end of the file:
source ~/.bash_profile
It will ask zsh to use all the information from bash like the path of jupyter.
Hope it can help you out!
I'm answering to my own question in case it can help others ;)
I found my answer here: https://medium.com/#singhaniatanay18/mac-os-catalina-update-zsh-instead-of-bash-d688f68f70b8
(see comments as well)
Mac OS BigSur:
Uninstall Anaconda:rm -f Anaconda-Navigator.app
re-install pip3 install jupyterlab
I just updated to Catalina, two days before Big Sur release.. oh well.
Catalina came with changes to security and bash, that will remain for future releases. So Catalina moves your anaconda3 folder to /Users/Shared/Previously Relocated Items/Security/anaconda3 I tried to move it back to home directory, but that didn't work. So I deleted it, and reinstalled Anaconda using the command line installer Not the GUI installer, and it worked for me. You can follow instructions here and use /Users/me/anaconda3 folder as recommended here.
Here are the commands that worked for me,
shasum -a 256 /Users/username/anaconda3 . Although not sure it did anything
bash ~/Downloads/Anaconda3-2020.02-MacOSX-x86_64.sh or whatever the name of the command line installer from Conda in your Download folder, or wherever else you downloaded it.
Use sudo in front of the command if permission was denied, then enter your log in password for your Mac
source /Users/username/anaconda3/bin/activate conda init zsh
sudo conda init zsh then enter your Mac's password.
You should be all set now, and all commands like ipython, conda info, jupyter notebook, pyspark will all work.
The last command will make step3 command persist i.e. initialize conda base environment, such that you can run conda, ipython, jupyter notebook the next time you use terminal.
Install the Jupyter using Homebrew in zsh shell
If you don't Python install 3.3or higher.
Open terminal
Using Homewbrew install jupyter
brew install jupyter
Now, you start a notebook
jupyter notebook
I am currently trying to work basic python - jupyter projects.
I am stuck on following error during matplotlib:
screenshot on jupyter-error
ModuleNotFoundError: No module named 'matplotlib'
I tried to update, reinstall matplotlib aswell in conda and in pip but it still not working.
happy over every constructive feedback
In a Notebook's cell type and execute the code:
import sys
!{sys.executable} -m pip install --user matplotlib
and reload the kernel
(src: http://jakevdp.github.io/blog/2017/12/05/installing-python-packages-from-jupyter/ )
open terminal and change the directory to Scripts folder where python installed. Then type the following command and hit enter
pip install matplotlib
Hope this will solve the issue.
I was facing the exact issue. It turns out that it was using the system Python version despite me having activated my virtual environment.
This is what eventually worked.
If you are using a virtual environment which has a name say myvenv, first activate it using command:
source activate myvenv
Then install module ipykernel using the command:
pip install ipykernel
Finally run (change myvenv in code below to the name of your environment):
ipykernel install --user --name myvenv --display-name "Python (myvenv)"
Now restart the notebook and it should pick up the Python version on your virtual environment.
While #Frederic's top-voted solution is based on JakeVDP's blog post from 2017, it completely neglects the %pip magic command mentioned in the blog post. Since 2017, that has landed in mainline IPython and the easiest way to access the correct pip instance connected to your current IPython kernel and environment from within a Jupyter notebook is to do
%pip install matplotlib
Take a look at the list of currently available magic commands at IPython's docs.
generally speaking you should try to work within python virtual environments. and once you do that, you then need to tell JupyterLab about it. for example:
# create a virtual environment
# use the exact python you want to work with in this step
python3.9 -m venv myvenv
# 'activate' (or 'enter') it
source myvenv/bin/activate
# install the exact stuff you want to use in that environment
pip install matplotlib
# now tell JupyterLabs about the environment
python -m ipykernel install --user --name="myenv" --display-name="My project (myenv)"
# start it up
jupyter notebook mynotebook
# if you now look under 'Kernel->Change kernel', your 'myenv' should be there
# select it (restart kernel etc if needed) and you should be good
The issue with me was that jupyter was taking python3 for me, you can always check the version of python jupyter is running on by looking on the top right corner (attached screenshot).
When I was doing pip install it was installing the dependencies for python 2.7 which is installed on mac by default.
It got solved by doing:
> pip3 install matplotlib
Having the same issue, installing matplotlib before to create the virtualenv solved it for me. Then I created the virtual environment and installed matplotlib on it before to start jupyter notebook.
in jupter notebook type
print(sys.executable)
this gave me the following
/Users/myusername/opt/anaconda3/bin/python
open terminal, go into the folder
/Users/myusername/opt/anaconda3/bin/
type the following:
python3 -m pip install matplotlib
restart jupyter notebook (mine is vs code mac ox)
If module installed an you are still getting this error, you might need to run specific jupyter:
python -m jupyter notebook
and this is also works
sudo jupyter notebook --allow-root