Comments (7)
He @traversaro, thanks for the write up. We remember this issue as we also started with conda
to run ROS.
The discussion on what is should be default in isolation is indeed a hard one, we still have to figure that out.
To help your users directly setting these variables can be set with the activation.scripts
You could just generate a clean_env.sh
and clean_env.bat
which exports these variables:
export PYTHONUSERBASE=intentionally-disabled
export PYTHONPATH=
from pixi.
Thanks @ruben-arts, we used your workaround in robotology/icub-models-generator#263 . Not sure if you want to keep this issue open or not, feel free to close if you think the problems discussed in the issue is tracked already somewhere else.
from pixi.
This is probably also related to #288, as the workaround of setting PYTHONPATH
could be simpler if it was possible to set env variables for all tasks and shells.
from pixi.
We remember this issue as we also started with
conda
to run ROS.The discussion on what is should be default in isolation is indeed a hard one, we still have to figure that out.
Indeed, I was aware of this for conda for a long time. The main difference I see between pixi and conda is about user expectation (or at least, how I started to introduce conda and pixi to our users). When I started to introduce conda, I always warned users that conda and apt are different things, it is important not to mix them, etc, etc (see https://github.com/robotology/robotology-superbuild/blob/master/doc/conda-forge.md and https://github.com/robotology/robotology-superbuild/blob/master/doc/install-mambaforge.md for example documents I pointed users to). So users are at least aware of possible conflicts.
The pixi story is a bit different. Quoting from https://prefix.dev/blog/uv_in_pixi#our-goals-for-pixi, the goal of pixi presented to the users is to be able to start working on a project with just:
Hence why I think it could make sense to think about what should be isolated by default in the pixi
case.
To help your users directly setting these variables can be set with the
activation.scripts
You could just generate a
clean_env.sh
andclean_env.bat
which exports these variables:export PYTHONUSERBASE=intentionally-disabled export PYTHONPATH=
Cool, that is indeed much better then my solution! I will probably start adding it by default to any pixi package using Python packages. Just to understand, are these pixi activation scripts expected to run before any conda package activation script? Otherwise I am afraid of corrupting the value of PYTHONPATH
set by some conda package. I could check directly the code, but I would like to understand if this is an implementation detail, or part of the documented and intended behavior of the functionality, thanks!
from pixi.
Yeah I totally agree with you!
Just to understand, are these pixi activation scripts expected to run before any conda package activation script? Otherwise I am afraid of corrupting the value of PYTHONPATH set by some conda package.
This is what the activation script looks like that we generate. As you can see we put the custom activation in last.
➜ pixi shell-hook
export PATH="/home/rarts/development/pixi/examples/ros2-nav2/.pixi/envs/default/bin:/home/rarts/.local/bin:/home/rarts/bin:/usr/lib64/ccache:/home/rarts/.cargo/bin:/home/rarts/.npm-global/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/var/lib/snapd/snap/bin:/home/rarts/.pixi/bin"
export CONDA_PREFIX="/home/rarts/development/pixi/examples/ros2-nav2/.pixi/envs/default"
export PIXI_ENVIRONMENT_PLATFORMS="osx-arm64,linux-64,osx-64"
export CONDA_DEFAULT_ENV="ros2-nav2"
export PIXI_PROJECT_ROOT="/home/rarts/development/pixi/examples/ros2-nav2"
export PIXI_ENVIRONMENT_NAME="default"
export PIXI_PROJECT_VERSION="0.1.0"
export PIXI_PROMPT="(ros2-nav2) "
export PIXI_PROJECT_MANIFEST="/home/rarts/development/pixi/examples/ros2-nav2/pixi.toml"
export PIXI_PROJECT_NAME="ros2-nav2"
. "/home/rarts/development/pixi/examples/ros2-nav2/.pixi/envs/default/etc/conda/activate.d/gazebo_activate.sh"
. "/home/rarts/development/pixi/examples/ros2-nav2/.pixi/envs/default/etc/conda/activate.d/gdal-activate.sh"
. "/home/rarts/development/pixi/examples/ros2-nav2/.pixi/envs/default/etc/conda/activate.d/geotiff-activate.sh"
. "/home/rarts/development/pixi/examples/ros2-nav2/.pixi/envs/default/etc/conda/activate.d/libglib_activate.sh"
. "/home/rarts/development/pixi/examples/ros2-nav2/.pixi/envs/default/etc/conda/activate.d/libxml2_activate.sh"
. "/home/rarts/development/pixi/examples/ros2-nav2/.pixi/envs/default/etc/conda/activate.d/proj4-activate.sh"
. "/home/rarts/development/pixi/examples/ros2-nav2/.pixi/envs/default/etc/conda/activate.d/ros-humble-ros-workspace_activate.sh"
. "/home/rarts/development/pixi/examples/ros2-nav2/.pixi/envs/default/etc/conda/activate.d/ruby_activate.sh"
. "/home/rarts/development/pixi/examples/ros2-nav2/clean_env.sh"
from pixi.
Ah, the problem is that for example in your use case /home/rarts/development/pixi/examples/ros2-nav2/.pixi/envs/default/etc/conda/activate.d/ros-humble-ros-workspace_activate.sh
also sets the PYTHONPATH
, so we would interfere with it if we unset the PYTHONPATH
in /home/rarts/development/pixi/examples/ros2-nav2/clean_env.sh
. Note that perhaps PYTHONPATH
set by ros-humble-ros-workspace_activate.sh
is not necessary, but I would need to double check this. Anyhow, this for sure is an improvement over setting the env variable manually in every step, thanks!
from pixi.
Closing this in favor of #289
from pixi.
Related Issues (20)
- Do not insert env var `CONDA_PREFIX` when run env command HOT 7
- `console` already respects environment variables
- Multi-line commands HOT 2
- https://pixi.sh/install.sh returns 404 HOT 1
- Interactive environment selection should be for all HOT 6
- `pixi add --platform` should support target selectors like `unix`
- Create pixi docker image HOT 3
- `pixi init --import` generates incorrect prefix
- pixi add option that takes in input a Python module name instead of conda package name HOT 4
- `pixi run` should prioritize calling command rather than task HOT 2
- pixi run confusing error when a command with spaces is passed inside a vector HOT 3
- Add pixi badge HOT 1
- Additional channel configuration HOT 6
- `pixi shell` Command Doesn't Work With Fish HOT 2
- `pixi init --import` parses channels wrong for custom quetz servers
- `-v` does not make `pixi search` any more verbose HOT 3
- `pixi global list` fails with error `No such file or directory (os error 2)` after fresh install HOT 1
- Make `--channel` CLI arg more convential by allowing multiple strings without repeated argument HOT 3
- Allow specification of `--platform` in `pixi global install` HOT 2
- `pixi run start` says "command not found" but it's only the platform that's missing
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pixi.