question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Conda env not activated

See original GitHub issue

I am a bit confused by the way environment.yml works.

I tried to install R and SageMath from conda-forge, with

name: sage-r-environment
channels:
  - conda-forge
dependencies:
  - python=2.7
  - sage
  - r-essentials

but when I launch the Jupyter server, neither R nor SageMath notebooks are available. SageMath also does not start from a terminal (it complains about some env variables not being set).

It seems that the reason is that the conda environment is not activated prior to launching the Jupyter server. The fix for me was to add a start file:

#!/bin/bash

source /srv/conda/bin/activate kernel
exec "$@"

Also, the fact that the environment is named kernel instead of sage-r-environment is surprising.

Demo repo is here: https://github.com/defeo/sage-r

Is this a bug, or am I doing something wrong?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:10 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
choldgrafcommented, Sep 29, 2018

hmmm that is strange - you shouldn’t need to do any source stuff in a start file. E.g. here’s the binder-examples conda repo:

https://github.com/binder-examples/conda/blob/master/environment.yml

Did you resolve this issue in the end, or still having problems with it? It feels like a bug to me…

0reactions
yuvipandacommented, May 21, 2019

@minrk did a bunch of work recently around activating conda environments at startup. Not sure if that applies to postBuild though. You can set your first line to #!/bin/bash -l to run a login Shell, which should activate the environment for you

Read more comments on GitHub >

github_iconTop Results From Across the Web

anaconda - Conda activate not working? - Stack Overflow
CommandNotFoundError: Your shell has not been properly configured to use 'conda activate '. If using 'conda activate' from a batch script, change ...
Read more >
Conda environment activation not working in PowerShell #8428
As a workaround, there is an option in VS Code to select cmd.exe as the terminal application.
Read more >
Managing environments - Conda
Activating environments is essential to making the software in the environments work well. Activation entails two primary functions: adding entries to PATH for ......
Read more >
Conda environment is not activated properly in Terminal with ...
Set the project interpreter to the conda environment just created · Make sure Activate virtualenv is check in Settings -> Tools -> Terminal...
Read more >
How to activate an Anaconda environment - Seminarsonly
This setting controls whether or not conda activates your base environment when it first starts up. You'll have the conda command available ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found