-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
environment variables not assigned via conda activate #5339
Comments
Thanks, I think I've seen this issue before with other projects, I'll try to figure out how we can support |
Thanks @stsewd, yes, I was able to solve the problem by manually setting |
I'd like to echo once again that this would be great to address, or at the very least document the current behavior. It has given me quite a hard time to figure out why my conda environment didn't seem to be the same as when I did it locally, and ultimately it was the lack of setup done by conda-activate |
we have a similar problem with a package that needs an env variable be set so it can find the file that contains package-level settings (libs, flags etc), see ESMValGroup/ESMValCore#2001 - the variable in cause is set at |
An alternative could be to use |
Is this still an issue? Is there any workaround we can document? I don't think we will change the way that we are running |
hi @humitos indeed this is still an issue - but it's inherent of the way things are done on Readthedocs, and if you guys don't want to change them it's okay - we found a workaround this thanks to @zklaus - conda variables are loaded via hot-wiring the main conda executable via build:
os: ubuntu-22.04
tools:
python: "mambaforge-4.10"
jobs:
post_create_environment:
# use conda run executable wrapper to have all env variables
- conda run -n ${CONDA_DEFAULT_ENV} pip install . --no-deps Cheers 🍺 |
@valeriupredoi thanks for sharing this chunk of YAML here. I'm sure it will be pretty useful to other users as well 💯 |
When running commands using "conda run", environment variables like CONDA_PREFIX are not available. version: 2
submodules:
include: all
recursive: true
build:
os: "ubuntu-22.04"
tools:
python: "mambaforge-22.9"
commands:
- mkdir build
- mamba env create --file environment.yml
- cd build && mamba run -n libmobility cmake -DCMAKE_INSTALL_PREFIX=/home/docs/checkouts/readthedocs.org/user_builds/libmobility/conda/libmobility .. && mamba run -n libmobility make -j4 all install
- cd docs && mamba run -n libmobility make html
- mkdir -p $READTHEDOCS_OUTPUT/
- mv ./docs/build/html $READTHEDOCS_OUTPUT/html Is there maybe some preferred place to install? Some environment variable perhaps? |
I think the path you have harcoded could be replaced by |
Details
Expected Result
from mpl_toolkits.basemap import Basemap
(basemap
one of the dependencies of my project) would happen without any errors, allowing autosummary to parse my docstrings and create the autogenerate API.Actual Result
The problem seems to be that
readthedocs
uses absolute paths within the conda environment but doesn't ever callconda activate ${evironment}
. As a result, conda packages do not set environment variables (which would normally happen as part ofactivate
and other packages fail because the environment variables are not present. In this case,proj4
should set$PROJ_LIB
, whichbasemap
expects to find.See conda-forge/basemap-feedstock#30 for a lengthy discussion of this issue
The text was updated successfully, but these errors were encountered: