Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to delete/downgrade python packages from Google Colab?

I'm using Google Colab, to test Keras models. A library I'm using (hyperopt) seems to misbehave with another library with a specific version (networkx == 2.1). It was mentioned that the latest version of hyperopt on the master branch of its repository has solved this problem, but it isn't working in my case.

I tried !pip uninstall networkx, followed by !pip install networkx==1.11, finally checking the version with

    import network x
    print(networkx.__version__)

Which still prints 2.1

Is it not possible to downgrade a package in Google Colab?

Error is similar to this: https://github.com/hyperopt/hyperopt/pull/319

Running Python 3.

like image 744
Maged Shalaby Avatar asked Mar 18 '18 12:03

Maged Shalaby


Video Answer


1 Answers

That might be happening because you imported networkx before uninstalling 2.1. You can just restart the notebook and go through the uninstall step before importing networkx.

[1] !pip uninstall networkx -y
Uninstalling networkx-2.1:
  Successfully uninstalled networkx-2.1

[2] !pip install networkx==1.11
Collecting networkx==1.11
  Using cached networkx-1.11-py2.py3-none-any.whl
Requirement already satisfied: decorator>=3.4.0 in /usr/local/lib/python3.6/dist-packages (from networkx==1.11)
Installing collected packages: networkx
Successfully installed networkx-1.11

[3] import networkx
[4] networkx.__version__
'1.11'
like image 185
Ankur Ankan Avatar answered Oct 18 '22 20:10

Ankur Ankan