I've been using anaconda for a while now and using the conda command relatively frequently. Recently I had to try installing miniconda for a new project. I ended up trying to delete the directory and reinstall it a new way following the tutorial from my school. I believe I used rm -rf /Users/MyUsername/software/pkg/miniconda3 . Now, anything I try to use the conda command for returns zsh: command not found: conda. Trying to open jupyter notebook returns zsh: command not found: jupyter Anaconda still exists on my computer inside /Users/MyUsername/opt/anaconda3 and conda terminal exists inside /Users/emilybaur/opt/anaconda3/condabin which I believe is the default location, so I'm confused why my terminal can't access it.
Anaconda Navigator still works and can open jupyter notebook, but nothing works through terminal. Could I have messed up the path being accessed by terminal somehow, or deleted a part of conda?
(Edited)
I've hit a dead end trying to solve/debug this issue which doesn't seem like it should be that difficult.
I'm working in Pycharm IDE (not the professional) and I'm working inside a virtual environment let's call it pythonProject and I want to be able to run launch a jupyter notebook in this environment so that it can pick up all the python packages i've installed and configured for this environment.
As I understand it from the documentation, these are the steps I need to take.
My terminal prompt statement:
(pythonProject) oliver#oliver-u20:~/pythonProject$
commands:
python3 -m pip install ipykernel
python3 -m pip install notebook
python3 -m ipykernel install --user --name pythonProject --display-name "Python (pythonProject)"
jupyter notebook
But when I load jupyter notebook, it only shows python3 under kernels.
I tried outputting
jupyter kernelspec list
And get only the base kernel which suggests from this that it's not finding my kernelspec, but I can't seem to figure from the documentation what i'm supposed to do.
Am I missing something?
Ok so I've solved this.
I think there was an install issue with jupyter.
I tried reproducing this in a completely new project and venv and could get the kernel showing.
In the project and venv where I still couldn't, I noticed a discrepancy in the output of my jupyter --paths
In the working venv I could see under data
/home/oliver/.local/share/jupyter
Which is where the kernels I installed are located.
However in the project that wasn't working there was instead:
/home/oliver/snap/jupyter/6/.local/share/jupyter
I'm guessing this snap path is from how I originally installed jupyter on my Ubuntu via the app store - seemed sensible at the time.
So I uninstalled jupyter, restarted my venv and the jupyter --paths has magically changed so that
/home/oliver/.local/share/jupyter
is present and when I start a jupyter notebook at the command line with
jupyter notebook
I can see all my kernels showing!
I found this quite difficult to debug with the documentation and command help outputs so hope someone else finds this useful.
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.
I am new to programming and would appreciate help.
I had been running code successfully but recently installed conda, which is causing issues.
Sys.executable shows
C:\Users\Ben\AppData\Local\Programs\Python\Python37-32\pythonw.exe
in IDLE and
C:\Users\Ben\AppData\Local\Programs\Python\Python37-32\python.exe in
the command prompt.
However, when I run a script from my desktop calling sys.executable in the command prompt, it shows P:\conda\python.exe. When I run other scripts from files on my desktop it also can no longer import modules, which are stored in the same folder as my original Python installation.
My question is: how can I change the interpreter for the files I am running from my desktop so that they can find the correct modules?
I have read all of StackOverflow's ModuleNotFound and sys.executable related threads but cannot fully understand what is going on - thanks for the help.
create new python environment on conda as follows and run your code on new env:
Actually using conda and conda navigator is the better approach
After conda installation:
- Open up the conda command prompt and create your working environment as follwos
conda create -n mytestenv python=3.7
Activate the environment:
conda activate mytestenv
Now, Run your code.
Later on if you need any module, Install your module using conda command on your selected environment, for example
conda install numpy
I have installed anaconda on my MAC laptop, and tried to run jupyter notebook to install it, but I get error jupyter command not found.
You need to activate your conda environment (source bin/activate) and then do
$ pip install jupyter # Alternatively, you can do `conda install jupyter`
$ jupyter notebook # to actually run the notebook server
Add $HOME/anaconda3/bin to your $PATH and jupyter-notebook should work. There are a ton of other binaries you can lookup in that folder as well.
export PATH=$HOME/anaconda3/bin:$PATH
then
jupyter-notebook
#ffledgling anwser did not work for me. What did solve was to install jupyter using conda:
conda install jupyter
That did the trick. Right after the installation finished I went with
jupyter notebook
as my next command and saw the server setup and the browser page opening.
I had this same problem on my Mac OS. I'm also new to Python, so forgive me if this is an obvious solution.
What solved it for me was installing Python with the 'install for me only' option rather than the hard-drive option. If it tells you you can't, then reselect it. After that, the command jupyter notebook opened without a problem.
Hope it can help someone!
How to
It could be as simple as opening a new Terminal window.
For Windows
After you can successfully run conda from powershell, you can install jupyter with: conda install jupyter command. Then re-open powershell and run conda run jupyter notebook.
If your issue is happening after running conda install jupyter, you can use conda init zsh to configure the ~/.zshrc automatically so that when you just type jupyter notebook on terminal, it can find it.
I ran into the same problem try this instead
jupyter-notebook
I had the same issue on Mac. I am using Miniconda
Opened ~/.zshrc profile on nano as, nano ~/.zshrc
and added the location of miniconda on my mac as the last line of the ~/.zshrc as:
export PATH="/usr/local/Caskroom/miniconda/base/bin:$PATH"
solves the issue easily.
Open a new terminal and try again, it worked for me. This is written somewhere in the installation guide "For this change to become active, you have to open a new terminal."
If it's a fresh installation. Close the the terminal and re-open
You don't have to install jupyter explicitly. Anaconda does for you.
Ensure the environment is activated first.
If you selected Yes when prompted "Do you wish the installer to initialize Anaconda3 by running conda init? [yes|no]" during installation, prepend your commands with conda
mycomp#55:~$ conda activate
(base) mycomp#55:~$ jupyter notebook
After installing Anaconda on windows 10, you can use Anaconda prompt from start menu to activate a conda enabled terminal window.
You can run Jupyter from that window using:
jupyter notebook
You should first have conda in your PATH environment. You can achieve it taking a look on this answer.
Now you just need to run jupyter notebook.