简体   繁体   中英

Unable to install jupyter notebook

I am receiving the following download error when I attempt to install Jupyter Notebook on Windows:

ERROR: Could not install packages due to an EnvironmentError: [Errno 2] No such file or directory: 'C:\\Users\\*redacted*\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python38\\site-packages\\jedi\\third_party\\django-stubs\\django-stubs\\contrib\\contenttypes\\management\\commands\\remove_stale_contenttypes.pyi' 

I located the commands folder and the file remove_stale_contenttypes.pyi was not present. I did a file search for my CPU and the file was not found in another location.

I have never used python, pip, or jupyter before. I am attempting to install them in preparation for a class.

Make sure the maximum file path length limitation is turned off on your windows machine.

In the Registry Editor, use the left sidebar to navigate to the following key: HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\FileSystem

On the right, find a value named LongPathsEnabled and double-click it. If you don't see the value listed, you'll need to create it by right-clicking the FileSystem key, choosing New > DWORD (32-bit) Value, and then naming the new value LongPathsEnabled.

In the value's properties window, change the value from 0 to 1 in the “Value data” box, and then click OK.

Here is a link to an article describing how to do this: https://www.howtogeek.com/266621/how-to-make-windows-10-accept-file-paths-over-260-characters/

Try uninstalling virtualenv or pipenv (whichever you are using) and then reinstalling. If this doesn't work try installing conda. There are two versions of it:

Anaconda Miniconda

I would recommend going with miniconda as it is a lightweight installation but does not have a GUI. Here is the link to install it. Afterwards to create a virtual environment do this:

Go to the conda terminal or cmd and type in conda create --name myenv (and change the name of the env to whatever you like). This should create your environment. Afterwards to activate it, type in conda activate name (Name is again what you put up there) Thats it. You have now created a conda env. So afterwards, whenever you want to access this enviornment again, use the activate command.

As for installing jupyter notebook, first activate your env and the run this:

conda install -c conda-forge notebook

This should install jupyter notebook in that environment. To access that jupyter notebook again, always activate the enviornment and then type in jupyter notebook . If this seems a bit too much for you, you should actually have a program named jupyter notebook(env name) in your computer after you successfully installed jupyter. Just click on that and it will handle everything for you.

Please let me know if you have trouble doing this.

The easiest way to setup Jupyter Notebook is using pip if you do not require conda. Since you are new to python, first create a new virtual environment using virtualenv.

Installing pip (Ignore if already installed): Download get-pip.py for Windows and run python get-pip.py

Installing virtualenv: pip install virtualenv

Creating a new virtual environment: virtualenv your_env_name

Activate Virtualenv: your_env_name\\Scripts\\activate

Installing Jupyter Notebooks: pip install notebook

You can launch the notebook server using: jupyter notebook

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