Solve module not found in jupyter notebook with binder

667 Views Asked by At

I have set up a jupyter notebook within a virtual environment. Now I want to deploy it with mybinder

I generated an environment.yml directly from the anaconda prompt.

name: test_environment
channels:
- conda-forge
dependencies:
  - python
  - numpy

The building with binder does not show any errors and the jupyter notebook is launched, but when I try to import the numpy module the notebook tells me that the module has not been found.

When I check on which environment the notebook is running with

!conda info

I see that it is running on the notebook environment and not on my test_environment. Yet I have no idea on how to guide binder to my specified environment as it is already in the same directory as my notebook.ipynb file

Note: I need my files to stay within a subdirectory of my repository.

1

There are 1 best solutions below

3
On

I had the same issue, and apparently, it has to do with how Binder searches for the environment.yml file as you suggested. In my case, the problem was solved by simply creating a new cleaner repo in GitHub with a more simple structure than the initial one I had. More specifically, the new repo has the following structure in the root directory (i.e. https://github.com/user_name/repo_name/):

- README.md
- analysis.ipynb
- environment.yml