Can't install Python 3 / Jupyter on Catalina properly - python

I'm trying to install python 3 and jupyter on Catalina.
I installed the latest version (3.7) from Anaconda distribution, but if I type
python --version in the command line I get "Python 2.7.16"
If I type jupyter notebook, i get zsh: command not found: jupyter
I have also installed python 3.8.2 from python.org, I thought this might help.
What can I do now to get it running?

try use python3 --version to see if you have python3 installed or not
suggest use brew install python to install python3
https://docs.brew.sh/Homebrew-and-Python

This is the solution for the jupyter problem:
cd into your installation directory of anaconda in terminal
Go into bin folder and drag the binary named conda into the terminal and type init zsh

Related

Installed a package on command line and can import it via command line. Receive ModuleNotFoundError when importing in jupyter notebook

I installed the python package lifelines on my terminal. The windows terminal is my terminal of choice, with a powershell and anaconda terminal that I often used.
I tried installing the package using the provided commands in the documentation:
pip install lifelines
and
conda install -c conda-forge lifelines
Both times the installation is marked as successfull. When I run Python within the terminal I can import the lifelines package without problem. However whem I import it on a jupyter notebook it yields a ModuleNotFoundError.
The base environment I use does not contain the lifelines package when I verify its contents using the Anaconda Navigator.
The jupyter notebooks are run on Anaconda Powershell, and so are the environments and packages.
Installing on the Windows Powershell will never work. Running the conda install -c conda-forge lifelines in the Anaconda shell solved the issue.
So silly, yet so time consuming it is worth sharing.
I had a issue like this, python3 -m pip install <package_name> solved it for me. Use python -m pip install <package_name> for Python2.

How do I deal with pip in different python versions?

I had python 3.8 installed and then I installed python 2.7. I am trying to run a python program with py -2 program.py in vs code using with python 2.7 as selected environment and I am getting an error, ImportError: No module named googlemaps even though I have already installed.
If I run the program using Python3 then it would run fine. Also when I open vs code using python 2.7 as selected runtime environment then I would get a warning Linter Pylint is not installed. If I click on install then I would get another warning There's no Pip installer available in the selected environment.
Also even though I have changed the python path from 3.7 to 2.7, default python version will still show up as 3.7 when I runPython in command line.
Things that I have tried to install the googlemaps module for python 2 after googling for solutions,
pip2 install googlemaps--upgrade
py -2 -m pip install googlemaps
If you have your python2 binary located, you can just call it directly:
/usr/bin/python2 -m pip install googlemaps
And if you're not sure where your python binary is, you can use
import sys
print(sys.executable)
to locate it.
And if you don't have pip, you should install it by downloading this file:
https://bootstrap.pypa.io/get-pip.py
then running:
/usr/bin/python2 get-pip.py
It is recommended to install Python 3.8 using Pyenv and also when you are using different versions of python, it is very useful
curl https://pyenv.run | bash
pyenv install 3.8.1
pyenv virtualenv 3.8.1 venv
pyenv local venv
with pyenv local you set your version for use.
If after this you run
pyenv version
It will output to 3.8.1
With regards to pip installation, run
whereis python
and if it outputs to
usr/bin/python2
then you can use pip for installing python2 packages and pip3 for packages compatible to python3.

Exception: Jupyter command `jupyter-notebook` not found, windows

So after installing VSCode and Python 3.7.4 (64 bit) I really struggle to make the "python interactive" work.
I have installed the Python extension in VScode, also jupyter and jupyter-lab but I keep getting the error "Exception: Jupyter command jupyter-notebook not found." when I try to run a cell/a line.
I am running Windows 10, using pip3
What did the trick was, that a few packages were outdated.
Firstly I had to uninstall pyzmq and install it again.
Then I ran pip3 install --upgrade nbconvert.
I also did pip install --upgrade pywin32==224 but I think the upper two solved the problem.
Lesson learned: Never use conda/pip together!
I believe you have to install anaconda first and start your notebook from an anaconda terminal.

Problem with Python Version And Jupyter Notebook

So I created a python 2.7 env "gdsenv" using anaconda:
Then I installed the jupyter kernel:
...so far it seems good.
The problem is that if I open jupyter-notebook, I don't get python 2.7 option (I have python 3.5 installed on another env):
Why is that and how can I fix that ?
See if you can install an ipython kernel for python2.
I don't have anaconda installed, but here's how it works for a virtual environment created with python2 -m virtualenv jupyter-test:
Install jupyter:
python2 -m pip install jupyter
Install ipython kernel for python2:
python2 -m pip install ipykernel
python2 -m ipykernel install --user
Start jupyter not[![ebook
jupyter notebook][1]][1]
You should now be able to create a python2 kernel:
See also this question which seems related:
Using both Python 2.x and Python 3.x in IPython Notebook .

How to Run iPython (and Jupyter notebook) for Python3.6.0 on Windows?

Just recently, I figured that I need to install the latest version of python (python 3.6.0) because it has pretty much all the dependencies to run the scikit-learn package with no issues.
I am a fan of ipython, and I use it frequently to run scripts on the previous version of python that I had (python 2.7). The problem is that I am not able to run ipython for the latest version of python that I have just installed (python 3.6.0).
Question: What are the possible ways that I should do to make the ipython switch to the latest version of python I have installed in my machine (python 3.6.0)?
Some description that might be helpful:
-I use Cygwin to run Unix-like command on the Windows command prompt (cmd.exe)
-I have successfully installed ipython using pip3 install ipython
C:\Users\MyComputer>pip3 install ipython
Collecting ipython
Downloading ipython-5.1.0-py3-none-any.whl (747kB)
100% |████████████████████████████████| 747kB 683kB/s
Any idea?
Thanks a lot!
I was having this problem too. I did it by
pip install virtualenv
virtualenv -p python3 myenv
# activate myenv as described here
# https://virtualenv.pypa.io/en/stable/userguide/
pip install ipython
ipython
I also found this worked
pip3 install ipython
FULL_PATH_TO/python3.6 FULL_PATH_TO/ipython

Categories

Resources