简体   繁体   中英

Can't run Jupyter Notebook with python 3.9 env

I'm new to using python and conda (and linux for that matter) and I've had some trouble running a Jupyter notebook through a python 3.9 environment. I've noticed that the base 3.8.5 environment works (and allows me to open Jupyter 6.1.4) , but I'm not sure why. I've updated anaconda and conda through conda update conda and conda update anaconda and get the same

# All requested packages already installed.

In the anaconda-navigator GUI, when I try to use a py39 environment and click install on Jupyter, I notice it tries to install Jupyter version 6.0.3 and I also get this error.

I've also tried to install pykernel into my env (not sure if it would've done anything to help my issue) in which I get:

$conda install ipykernel
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: \ 
Found conflicts! Looking for incompatible packages.
This can take several minutes.  Press CTRL-C to abort.
failed                                                                                                                                      

UnsatisfiableError: The following specifications were found
to be incompatible with the existing python installation in your environment:

`Specifications:

  - ipykernel -> python[version='>=2.7,<2.8.0a0|>=3.5,<3.6.0a0|>=3.6,<3.7.0a0|>=3.8,<3.9.0a0|>=3.7,<3.8.0a0']

Your python: python=3.9


     Found conflicts! Looking for incompatible packages.
    This can take several minutes.  Press CTRL-C to abort.
    failed                                                                                                                                    
    
    UnsatisfiableError: The following specifications were found
    to be incompatible with the existing python installation in your environment:
    
    Specifications:
    
      - ipykernel -> python[version='>=2.7,<2.8.0a0|>=3.5,<3.6.0a0|>=3.6,<3.7.0a0|>=3.8,<3.9.0a0|>=3.7,<3.8.0a0']
    
    Your python: python=3.9

I'm assuming that is why Jupyter was unable to install notebook. I'm really new to this stuff so if any more detail is required from me, please let me know. I don't really understand this issue and can't find anything similar.

You can follow the steps below:

  1. conda create -n py39 python=3.9
  2. pip3 install --upgrade pip
  3. pip3 install jupyter
  4. Go to anaconda prompt
  5. Activate py39
  6. Run jupyter-notebook
  7. Run after changing path as per your machine : python C:\\ProgramData\\Anaconda3\\envs\\py39\\Scripts\\pywin32_postinstall.py -install
  8. Run : jupyter-notebook from anaconda prompt
  9. Check version of Python on Jupyter notebook.

What I tried, basen on Pushpendra Singh Nathavat's response is:

conda create -n py39 python=3.9 -y 
conda activate py39
pip install jupyter
jupyter notebook

You can check the Python version inside the notebook using:

import sys
sys.version

Yo must write three code in the terminal.

  1. conda create -n py39 python=3.9
  2. pip3 install --upgrade pip
  3. pip3 install jupyter

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM