pip installed google.colab and now unable to run code on Jupyter notebook

被刻印的时光 ゝ 提交于 2021-02-08 04:41:06

问题


I installed google.colab using pip install google.colab in my terminal, after doing this the jupyter notebook that I was working on stopped working. When I opened a new jupyter notebook, I could not run any code. When I tried to run any code it stayed stuck on In[*]. Before installing google.colab my notebooks were working fine. I tried restarting my kernel but that did not work. I also used pip uninstall google.colab but that gives the following: WARNING: Skipping google.colab as it is not installed. Then I tried uninstalling it by pip uninstall google-colab, which uninstalled it succesfully, but did not fix the issue.

I'm not sure if google.colab was the cause of not being able to run code on the jupyter notebook, but this happened immediately after the installation.

I have the following packages including version for jupyter

jupyter                            1.0.0    
jupyter-client                     5.3.3    
jupyter-console                    6.0.0    
jupyter-core                       4.5.0    
jupyterlab                         1.1.4    
jupyterlab-server                  1.0.6 

Can anyone help me? Thank you


回答1:


I just had the exact same problem and here is what I did to solve it.

It is caused by the fact that when you installed google.colab it required a lot of packages whose versions are significantly older than the current versions that's commonly used. So if you already have the newer version of those packages installed (and depended by jupyter), pip will actually uninstall your newer version and install the older version google.colab demanded. This bad behavior causes jupyter to fail.

pip install google.colab
...
ERROR: tensorboard 2.2.2 has requirement google-auth<2,>=1.6.3, but you'll have google-auth 1.4.2 which is incompatible.
Installing collected packages: portpicker, pandas, six, google-auth, tornado, simplegeneric, prompt-toolkit, ipython, ipykernel, idna, requests, notebook, google.colab
  Attempting uninstall: pandas
    Found existing installation: pandas 1.0.4
    Uninstalling pandas-1.0.4:
      Successfully uninstalled pandas-1.0.4
  Attempting uninstall: six
    Found existing installation: six 1.15.0
    Uninstalling six-1.15.0:
      Successfully uninstalled six-1.15.0
  Attempting uninstall: google-auth
    Found existing installation: google-auth 1.18.0
    Uninstalling google-auth-1.18.0:
      Successfully uninstalled google-auth-1.18.0
  Attempting uninstall: tornado
    Found existing installation: tornado 6.0.4
    Uninstalling tornado-6.0.4:
      Successfully uninstalled tornado-6.0.4
  Attempting uninstall: prompt-toolkit
    Found existing installation: prompt-toolkit 3.0.5
    Uninstalling prompt-toolkit-3.0.5:
      Successfully uninstalled prompt-toolkit-3.0.5
  Attempting uninstall: ipython
    Found existing installation: ipython 7.15.0
    Uninstalling ipython-7.15.0:
      Successfully uninstalled ipython-7.15.0
  Attempting uninstall: ipykernel
    Found existing installation: ipykernel 5.3.0
    Uninstalling ipykernel-5.3.0:
      Successfully uninstalled ipykernel-5.3.0
  Attempting uninstall: idna
    Found existing installation: idna 2.9
    Uninstalling idna-2.9:
      Successfully uninstalled idna-2.9
  Attempting uninstall: requests
    Found existing installation: requests 2.23.0
    Uninstalling requests-2.23.0:
      Successfully uninstalled requests-2.23.0
  Attempting uninstall: notebook
    Found existing installation: notebook 6.0.3
    Uninstalling notebook-6.0.3:
      Successfully uninstalled notebook-6.0.3    
Successfully installed google-auth-1.4.2 google.colab idna-2.8 ipykernel-4.6.1 ipython-5.5.0 notebook-5.2.2 pandas-0.24.2 portpicker-1.2.0 prompt-toolkit-1.0.18 requests-2.21.0 simplegeneric-0.8.1 six-1.12.0 tornado-4.5.3

When you uninstalled the google.colab, those older version packages stayed. So the solution is to update those packages to their versions before you installed google.colab.




回答2:


If you have uninstalled collab thats good now you have to go to the anaconda prompt shell. type in the command:

pip list --outdated

It will show you all the packages which are outdated on your PC. Then close anaconda prompt shell and now go to windows powershell.( You can just search in the searchbox of taskbar. Run the windwos powershell and type this command:

pip freeze | %{$_.split('==')[0]} | %{pip install --upgrade $_}

This will take a while and you may see some red but after all the upgrades are done. Exit the powershell and restart anaconda and see if this works.




回答3:


It is very simple:

  1. Go to environment in Jupyter.
  2. See in which environment notebook is not working/not output.
  3. On the environment select environment which is not working.
  4. Remove the environment.
  5. Reinstall the required environment by directly adding the Python version you want; it takes around 5-10 minutes.


来源:https://stackoverflow.com/questions/61583918/pip-installed-google-colab-and-now-unable-to-run-code-on-jupyter-notebook

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!