secokit123
secokit123

Reputation: 41

How to use Conda-installed Python module outside environment

I have downloaded cusignal with Conda using:

conda create -n rapids-22.02 -c rapidsai -c nvidia -c conda-forge \
    cusignal=22.02 python=3.8 cudatoolkit=11.2

I have many other libraries that I use in main terminal, i.e., without activating environment. However, I cannot access the cusignal module from there:

mark@linuxdesktop:~ python3
>>import cusignal

No library found. But when I activate the environment that I have downloaded the cusignal library it doesn't give any error.

(rapids-22.02) mark@linuxdesktop:~ python3
>>import cusignal

To be able to use the cusignal properties in main system, is there any way to access that library without activating this environment?

Upvotes: 0

Views: 891

Answers (1)

merv
merv

Reputation: 76950

Not in any way that isn't a hack. The RAPIDS libraries rely on compiled packages that are managed through Conda, and trying to load the module outside of the context that provides those compiled libraries can lead to undefined behavior (e.g., missing symbol references).

PYTHONPATH (not recommended)

Technically, if the Python version matches up through minor (e.g., both are 3.8), one could try including the environment's site-packages via the PYTHONPATH environment variable. That is, something like,

mark@linuxdesktop:~ PYTHONPATH=/path/to/envs/rapids-22.02/lib/python3.8/site-packages python3
>> import cusignal

should at least find the package, but it might have an issue loading shared libraries.

Upvotes: 1

Related Questions