0

The Jupyter notebook worked initially, but I tried importing tensorflow and that would not work, so that led to me messing up everything.

I basically messed everything up, and I feel like the only way out now is to just nuke my device and restart. I had no idea what pip and anaconda are (still don't really), tried a bunch of funky updates and installations and whatever and now everything is just dead. My jupyter notebook cannot even run the normal python kernel.

How can I hard reset everything?

As a bonus, if someone were to ELI5 the difference between conda, pip, gitbash, and PowerShell are. And what versions of stuff does Jupyter run on (since my conda and device had different versions of things I think?). I use Windows 10.

Nimantha
  • 6,405
  • 6
  • 28
  • 69

3 Answers3

0

My first piece of advice is to not use Windows, though I'll probably get downvote spam for that. On Ubuntu, I could stuff Jupyter setup into one line:

# update, install python3, python3-dev, and pip3; get pip packages
sudo apt-get update && sudo apt-get install -y python3 python3-dev python3-pip && sudo -H python3 -m pip install jupyter notebook ipykernel tensorflow

Once the packages are installed, it's as easy as running jupyter notebook in the terminal.

Anaconda is a distribution of Python that includes a ton of pre-built packages, including Jupyter and scipy, numpy, pandas, etc. It's an "out of the box" solution basically, that comes with most of the tools you need. "Pip" is a package manager for Python; pip install [package] lets you use a package in your script, like import [package]. In this case, that's tensorflow.

ipykernel is a package that will open up a Python kernel for Jupyter. You could run a Jupyter notebook on a Python3.7 backend but do stuff with Python2 code by installing ipykernel with Python2's pip, usually (on Ubuntu) sudo apt-get update && sudo apt-get install -y python-pip && sudo -H python -m pip install ipykernel.

What happens when you run jupter notebook? Do you get errors? Can you get the notebook to open, but there's just no kernel to attach to a notebook?

Lewis
  • 4,285
  • 1
  • 23
  • 36
  • It opens and I have kernels, except none of them work. It gets stuck at Kernal starting, please wait. I tried making a couple of my own kernels through python venv and normal conda create env because I saw that was recommended. The normal python one doesn't work as well as all the ones I created. At this point I kinda want to just delete pip delete anaconda and delete jupyter and start over. Is this a good idea? – 9j09jf02jsd Jan 16 '20 at 04:26
  • virtualenv's are super hip and cool and everyone says to use them but I never do. They break stuff often. Try restarting your computer and restarting the notebook. Can you get a kernel to load? – Lewis Jan 16 '20 at 04:29
  • 1
    just tried restarting, ONE of the kernels works now! The default python one does not work. But I made 3 test kernels and for some reason only one of those works now. I'm not sure what the difference between those are - I think but am not sure that the one that works I made with conda, and the other two I made with venv. Would you know how to get the default python one to work again? – 9j09jf02jsd Jan 16 '20 at 04:37
  • I'm sorry dude, if it comes down to troubleshooting Windows I can't help really, I managed to avoid it most of my life. No idea how python works in a Windows system. There's probably someone who will help you, so this bump shouldn't hurt. – Lewis Jan 16 '20 at 04:40
  • Ah ok no worries. Thanks still! – 9j09jf02jsd Jan 16 '20 at 04:42
  • Even more strangely, the working kernel is not even on my anaconda anymore since I uninstall and reinstalled it. I have no idea how any of this works lol – 9j09jf02jsd Jan 16 '20 at 04:50
0

I have just set up a new Windows 10 machine for Python, Jupyter, and Tensorflow. I did the set-up without anaconda. I did the normal set-up procedure with some special steps:

1) Python 3.8 und Jupyter as installed by "pip install" does not work. You need to add three lines of code in a module that is installed as dependency when you install Jupyter. change asyncio.py

2) Current Tensorflow does not work with Python 3.8. You need to install Python 3.7. You don't need to delete your Python 3.8 if you have one. Create a virtual environment with virtualenv as described here and give the Path to your Python 3.7 Special Python in virtualenv

3) If you want to use GPU for NVIDIA in Tensorflow, you need to deal with the fact that two things do not fit together: current Tensorflow and the current version of ‘NVIDIA GPU Computing Toolkit’ (a tools you need for GPU support). Take a look here for the fix: cudart64_XYZ.dll not found

Andi Schroff
  • 1,156
  • 1
  • 12
  • 18
  • Hi, I will do the python 3.7 stuff once I get there, but first, none of my kernels are working at all. How do I get a functional kernel? I can't do anything, even like 3 + 3 on any of my kernels that I made. I am running jupyter on my virtual environment but it still has my old kernels - how do I make a new one form python venv? – 9j09jf02jsd Jan 26 '20 at 06:01
0

Let's start with the basics:

As a bonus, if someone were to ELI5 the difference between conda, pip, gitbash, and powershell are

You probably know the classical cmd.exe which opens a basic terminal where you can use different commands and call programs from. It is basically a text based way to interact with your operating system.

Powershell is in my understanding just an extension of this (I don't use it myself) and has more capabilities of what you can do and also better scripting support.

gitbash is an optional tool that you probably installed when you installed git on your computer. It emulates a bash shell that many people are used to from different operating system like ubuntu where bash is often the default terminal and therefore makes it easier to use, as all the syntax and commands are then the same as these ppl are used.

Neither of these is in any way directly related to using python on your computer other than being able to type python or jupyter notebook into these terminals to start the applications.

To the more python specific questions:

conda is a package and virtual environment management tool. It can be used to install a variety of software and also create virtual environments to keep different set ups seperate from one another (e.g. different python versions on the same machine). But it is not limited to python. It is pre-installed when you download and install miniconda or anaconda which are two python distributions.

pip is a package manager only for python packages and comes pre-installed with most python distributions.

anaconda/miniconda , often times confused with conda are two python distributions, i.e. what you would consider as "I installed python on my system" that come with the conda package manager pre-installed. miniconda does thereby not ship any other packages while anaconda comes with a long list of useful packages pre-installed and is therefore a popular choice when you want an easy acces into using python for your research

For more info, you can also read understanding-conda-and-pip

How can you save your system now

I basically fucked everything up

Difficult to access the current state of your system, but I would suggest you try the following steps to get to a working condition again:

  1. Go into Setting -> Apps and remove everything that is related to python or anaconda. Make sure that everything is deleted by also searching (using windows search feature) for python or conda folders somewhere in C:\Users. This should make sure that everything about your setup is purged
  2. Make sure that neither python, pip or jupyter commands are working anymore in your cmd (confirming the purge)
  3. Download and install miniconda
  4. Now Create a virtual environment and install tf. This is a good way to go because if you should manage to f*k up the environment, you can just delete and recreate it without much trouble:

conda create -n venv pip python=3.7 #create environment
conda activate venv #activate the environment
conda install jupyter #for jupyter notebook
pip install https://storage.googleapis.com/tensorflow/windows/gpu/tensorflow_gpu-2.1.0-cp37-cp37m-win_amd64.whl

  1. Start jupyter notebook: jupyter notebook. Since it only exists in this environment, same as tensorflow, there should be no more issues to use tensorflow normally
FlyingTeller
  • 17,638
  • 3
  • 38
  • 53
  • Thank you! I followed these instructions, however, my jupyter notebook still has the same old 4 kernels even when I open jupyter notebook in the new miniconda environment venv. How do I get the new kernel to show up? – 9j09jf02jsd Jan 25 '20 at 03:29
  • You completely uninstalled everything and `where jupyter` points to the directory belonging to the venv? – FlyingTeller Jan 26 '20 at 18:53