I've recently installed conda on Windows Subsystem for Linux. When I create a new conda environment and either run Python in the terminal or open a Jupyter notebook in VScode, I'm able to import packages that don't exist in this environment.
Here's all that I've done:
conda create -n myenv python=3.10.9 --no-default-packages
conda activate goldrush
conda list
This conda list command gives the expected output:
# packages in environment at /home/csa/anaconda3/envs/goldrush:
#
# Name Version Build Channel
_libgcc_mutex 0.1 conda_forge conda-forge
_openmp_mutex 4.5 2_gnu conda-forge
asttokens 3.0.0 pyhd8ed1ab_1 conda-forge
bzip2 1.0.8 h4bc722e_7 conda-forge
ca-certificates 2025.1.31 hbcca054_0 conda-forge
comm 0.2.2 pyhd8ed1ab_1 conda-forge
debugpy 1.8.12 py310hf71b8c6_0 conda-forge
decorator 5.1.1 pyhd8ed1ab_1 conda-forge
exceptiongroup 1.2.2 pyhd8ed1ab_1 conda-forge
executing 2.1.0 pyhd8ed1ab_1 conda-forge
importlib-metadata 8.6.1 pyha770c72_0 conda-forge
ipykernel 6.29.5 pyh3099207_0 conda-forge
ipython 8.32.0 pyh907856f_0 conda-forge
jedi 0.19.2 pyhd8ed1ab_1 conda-forge
jupyter_client 8.6.3 pyhd8ed1ab_1 conda-forge
jupyter_core 5.7.2 pyh31011fe_1 conda-forge
keyutils 1.6.1 h166bdaf_0 conda-forge
krb5 1.21.3 h659f571_0 conda-forge
ld_impl_linux-64 2.43 h712a8e2_2 conda-forge
libedit 3.1.20240808 pl5321h7949ede_0 conda-forge
libffi 3.4.4 h6a678d5_1
libgcc 14.2.0 h77fa898_1 conda-forge
libgcc-ng 14.2.0 h69a702a_1 conda-forge
libgomp 14.2.0 h77fa898_1 conda-forge
liblzma 5.6.3 hb9d3cd8_1 conda-forge
liblzma-devel 5.6.3 hb9d3cd8_1 conda-forge
libnsl 2.0.1 hd590300_0 conda-forge
libsodium 1.0.20 h4ab18f5_0 conda-forge
libsqlite 3.48.0 hee588c1_1 conda-forge
libstdcxx 14.2.0 hc0a3c3a_1 conda-forge
libstdcxx-ng 14.2.0 h4852527_1 conda-forge
libuuid 2.38.1 h0b41bf4_0 conda-forge
libxcrypt 4.4.36 hd590300_1 conda-forge
libzlib 1.3.1 hb9d3cd8_2 conda-forge
matplotlib-inline 0.1.7 pyhd8ed1ab_1 conda-forge
ncurses 6.5 h2d0b736_3 conda-forge
nest-asyncio 1.6.0 pyhd8ed1ab_1 conda-forge
openssl 3.4.0 h7b32b05_1 conda-forge
packaging 24.2 pyhd8ed1ab_2 conda-forge
parso 0.8.4 pyhd8ed1ab_1 conda-forge
pexpect 4.9.0 pyhd8ed1ab_1 conda-forge
pickleshare 0.7.5 pyhd8ed1ab_1004 conda-forge
pip 25.0 pyh8b19718_0 conda-forge
platformdirs 4.3.6 pyhd8ed1ab_1 conda-forge
prompt-toolkit 3.0.50 pyha770c72_0 conda-forge
psutil 6.1.1 py310ha75aee5_0 conda-forge
ptyprocess 0.7.0 pyhd8ed1ab_1 conda-forge
pure_eval 0.2.3 pyhd8ed1ab_1 conda-forge
pygments 2.19.1 pyhd8ed1ab_0 conda-forge
python 3.10.16 he725a3c_1_cpython conda-forge
python-dateutil 2.9.0.post0 pyhff2d567_1 conda-forge
python_abi 3.10 5_cp310 conda-forge
pyzmq 26.2.1 py310h71f11fc_0 conda-forge
readline 8.2 h8228510_1 conda-forge
setuptools 75.8.0 pyhff2d567_0 conda-forge
six 1.17.0 pyhd8ed1ab_0 conda-forge
sqlite 3.48.0 h9eae976_1 conda-forge
stack_data 0.6.3 pyhd8ed1ab_1 conda-forge
tk 8.6.13 noxft_h4845f30_101 conda-forge
tornado 6.4.2 py310ha75aee5_0 conda-forge
traitlets 5.14.3 pyhd8ed1ab_1 conda-forge
typing_extensions 4.12.2 pyha770c72_1 conda-forge
tzdata 2025a h78e105d_0 conda-forge
wcwidth 0.2.13 pyhd8ed1ab_1 conda-forge
wheel 0.45.1 pyhd8ed1ab_1 conda-forge
xz 5.6.3 hbcc6ac9_1 conda-forge
xz-gpl-tools 5.6.3 hbcc6ac9_1 conda-forge
xz-tools 5.6.3 hb9d3cd8_1 conda-forge
zeromq 4.3.5 h3b0a872_7 conda-forge
zipp 3.21.0 pyhd8ed1ab_1 conda-forge
zlib 1.3.1 hb9d3cd8_2 conda-forge
no numpy, no matplotlib, etc. However, when I do
code mycode.ipynb
and select the myenv environment (I have the little message in the top right of my VScode window telling me I am, indeed, running Python in myenv), I'm able to import those packages with no problem. I need to create an environment with particular versions of packages for one critical package to run, and for that to work, I can't have Python reverting to the base environment every time I run the import command. What am I doing wrong?