Some dependencies were installed yesterday. Why is it that the dependencies are not installed today?Do I have to reinstall dependencies every time I start up after the timeout?
For example, pandas, numpy, etc.
yesterday,
conda install pandas
conda install numpy
Hi. There are ways to go about this so you won’t have to reinstall every time you try to run your notebook.
You’ll need to help us help you by sharing a bit more information.
Are you working on a Jupyter notebook locally? On a notebook served remotely via Jupyterhub? On a notebook served remotely via MyBinder.org?
On a notebook served remotely via Jupyterhub,
and I started the notebook service according to the link below,
https://notebooks.gesis.org/user/xxx@gmail.com/tree
Every time the service is restarted according to this, the environment is reset.
UPDATE:
Because the mention of Gesis rung a bell, I found a link to a better introduction to what I think you are using(?). See https://notebooks.gesis.org/ . There it says your repo should be ‘Binder-ready’. That means you’ll want a configuration file in there called requirements.txt
and the contents of the file requirements.txt
would be the following for the packages you listed in your original post:
pandas
numpy
Then with that requirements.txt
file in your repository, when it starts up the session you’ll have those two packages installed.
If you absolutely need to install some other items using conda, you can move to using an environment.yml
file instead of requirements.txt
. environment.yml
allows specifying both conda- and pip-installable items. See here and here for more about that.
What I originally wrote in a draft of my reply is found below and may be worth a read because I think it provides more background that might help you better understand what is going on or offer you options:
I have used Gesis some as they are in the binder federation. However, only really via Binder where it is clear you include a requirements.txt
file that would include pandas and numpy listed and then when the session starts they are already installed. See here and here.
Those packages you listed are at the PyPi repository so you can simply use the pip package manager to install them, which is what requirements.txt
uses.
Alternatively, you can put the following lines as a cell early in your notebook if you don’t want to bother with environment configuration settings:
%pip install pandas
%pip install numpy
Note the use of %
at the start. That magic works for conda, too, and is now the current ‘best practice’ preferred to do installing when you are in a notebook. See here.
Thanks for your answer which solved my problem
I exported the environment.yml
file under the virtual environment ‘notebook‘ project,
But when I restarted the notebook service of gesis, some of the dependencies in the environment.yml
file were not installed, such as catboost, xgboost, etc.
Why are all the dependencies of environment.yml not installed?
I am not seeing catboost
install be an issue. I just tried it here and the first two cells of that notebook I forked from elsewhere run fine indicating install worked. Plus adding the cell catboost.datasets.amazon()
gives output.
Maybe relax the specific versions you have listed and try again?
You can use repo2docker to debug locally if the MyBinder build messages are going by too fast to help you.
Thanks for your very clear explanation.
I added cells to the beginning of the notebook and installed keras and tensorflow