4

I'm trying to learn reinforcement learning, doing coding on Jupyter notebook. But when I try to install stable baselines I'm getting an error even though I've installed it and upgraded it several times. I'm attaching the screenshots as well. Appreciate any help.enter image description here

enter image description here

Anandakrishnan
  • 347
  • 1
  • 4
  • 18

2 Answers2

4

I have just changed my answer, after talking to you I realised you have not installed in on your local computer.

If you are going to use jupyter.org's jupyter notebook, there is a better option. Jupyter.org's notebook doesn't have the best support for third party modules like this. It's just meant for testing small snippets of code. It probably doesn't have all the other requirements for running stable-baselines3 because it might be running on a minimal server environment. It's not meant for heavy usage like what you are suggesting.

Go to this website, https://colab.research.google.com and login using your google / gmail account. It's completely free.

Create a new notebook.

Type this in the cell and run it.

!pip install stable-baselines3[extra]

Next type this in another cell and run it.

import stable_baselines3

It works completely fine for me here.

If you want to install jupyter notebook on you computer and run it locally, you can try this guide, https://jupyter.org/install

If you don't want to try any of the options I suggested in the comments, you can check out this notebook on kaggle, https://www.kaggle.com/scratchpad/notebook7bff89da55/edit you can use it for free for 15 minutes without signing in.

anarchy
  • 3,709
  • 2
  • 16
  • 48
  • hey I tried both, didn't work. I'm using jupyter notebook btw. – Anandakrishnan Nov 07 '21 at 15:17
  • @aei_kay could you try creating a new conda environment and trying again and seeing if theres an error? – anarchy Nov 07 '21 at 15:22
  • i didn't get what do you mean by the conda environment. – Anandakrishnan Nov 07 '21 at 16:35
  • i am guessing you are using anaconda correct? – anarchy Nov 07 '21 at 16:38
  • no jupyter notebook in browser – Anandakrishnan Nov 07 '21 at 16:41
  • how are you launching it? – anarchy Nov 07 '21 at 16:42
  • i go to the jupyter.org page and then "try it using the browser". Its running on binder. – Anandakrishnan Nov 07 '21 at 16:44
  • 1
    @aei_kay ok.. now i know what to do, please take a look at my answer again. – anarchy Nov 07 '21 at 16:47
  • I thank you for the help and time you have taken. But I wanted to work on jupyter notebook because I'm trying to use openaigym in the project after a while and running it on colab is a bit difficult. Besides, I was following a tutorial and all were able to do the same work without any issue in the Jupyter notebook and I wanted to know why I wasn't able to. Still appreciate it. – Anandakrishnan Nov 07 '21 at 16:51
  • 1
    @aei_kay what i am showing is actually jupyter notebook running on google servers. there is no difference between google colab and jupyter notebook. its completely free. i suggest you install jupyter notebook on your computer instead, that website isnt a full jupyter notebook environment thats why it's not working properly for you – anarchy Nov 07 '21 at 16:52
  • sure then. I'll do that. – Anandakrishnan Nov 07 '21 at 16:54
  • @aei_kay running jupyter notebooks require computing power, if you think about it, jupyter.org isnt a website which would provide something like that for free, they are more about the development of the jupyter notebook software, there are many other options where you can use a jupyter notebook environment such as google cloud, aws, deepnote (free), colab(free), kaggle(free), and azure note. of course you can choose to install it locally as well and use the computing power of your computer. – anarchy Nov 07 '21 at 16:56
  • @aei_kay check out this notebook on kaggle, you can use it for 15 mins without signing in, it uses stable_baselines as well https://www.kaggle.com/scratchpad/notebook7bff89da55/edit – anarchy Nov 07 '21 at 17:00
  • @aei_kay i hope i answered you question, if i did please mark my answer correct. thanks! – anarchy Nov 07 '21 at 17:02
  • I was able to do it properly on jupyter notebook when I ran it locally. Thanks. – Anandakrishnan Nov 16 '21 at 17:13
1

I had the same problem.
In my case it's because of memory shortage.
I changed my docker environment's memory limit from 2gb to 8gb then this problem has been solved.

Nobuhito Kurose
  • 538
  • 5
  • 12