Anaconda site-packages
Solution 1
You can import the module and check the module.__file__
string. It contains the path to the associated source file.
Alternatively, you can read the File
tag in the the module documentation, which can be accessed using help(module)
, or module?
in IPython.
Solution 2
Run this inside python shell:
from distutils.sysconfig import get_python_lib
print(get_python_lib())
Solution 3
Linux users can find the locations of all the installed packages like this:
pip list | xargs -exec pip show
Updated 2022-03-21 to remove the unwanted table heading at the top of pip list output:
pip list | tail -n +3 | xargs -exec pip show
Solution 4
One more option using the interpreter:
import site; print(''.join(site.getsitepackages()))
And using a terminal/prompt:
python -c "import site; print(''.join(site.getsitepackages()))"
Also in this case you can easily print one of the directory (in case there are more than one) using own filter
Solution 5
I installed miniconda and found all the installed packages in /miniconda3/pkgs
Nyxynyx
Hello :) I have no formal education in programming :( And I need your help! :D These days its web development: Node.js Meteor.js Python PHP Laravel Javascript / jQuery d3.js MySQL PostgreSQL MongoDB PostGIS
Updated on July 25, 2022Comments
-
Nyxynyx almost 2 years
After installing a package in an anaconda environment, I'll like to make some changes to the code in that package.
Where can I find the
site-packages
directory containing the installed packages? I do not find a directory/Users/username/anaconda/lib/python2.7/site-packages
-
Codious-JR about 8 yearsconda list, just gave me " packages in environment at /Users/user/anaconda:" as output. The exact location for the packages was required, which is /Users/user/anaconda/lib/python2.7/'.
-
ivan-k about 8 yearsHere is some elegant use of
xargs
! -
Ben Farmer over 4 yearsMy problem is that I get a package import "not found" error for the package that conda supposedly installed. So I would like to check where conda thinks that it installed the package.
-
Arcturus B over 4 years@BenFarmer: this sounds like a rather different problem. Have you tried searching for something along the line of "conda list installed package paths"? This returns stackoverflow.com/q/46767012 and stackoverflow.com/q/47138241.
-
Christian4145 about 4 years'conda list' is a very good idea when you want to know from which repository a package was installed. It also shows an installation via pip. So this is a really good tip although it does not answer the question.
-
BrB about 4 yearsthanks @Arcturus B just adding one example
example: >>import tensorflow >>tensorflow.__file__
-
Dan Nissenbaum about 4 yearsThis answer actually works for me - not sure why it's downvoted!
conda list
, as its first line, spits out the root of your conda installation; inside that is thepkgs
folder. -
Dan Nissenbaum about 4 years... actually (re. my preceding comment), inside the root of the
miniconda
installation I find some packages at 'lib/python3.7/site-packages' -
numbers3567 almost 4 yearsi just used: pip show <package-name>. It worked, I got the files.
-
Charlie Parker over 3 yearsbut he said he is using conda...?
-
Charlie Parker over 3 yearsmy problem is that I see it in conda list but I can't find where it would be located...any ideas?
-
Charlie Parker over 3 yearsmy problem is that I see it in conda list but I can't find where it would be located...any ideas?
-
Charlie Parker over 3 yearsmy problem is that I see it in conda list but I can't find where it would be located...any ideas?
-
Charlie Parker over 3 yearsmy problem is that I see it in conda list but I can't find where it would be located...any ideas?
-
Martijn Pieters over 3 years@CharlieParker it sounds like you want to be able to list the files in a given conda package: stackoverflow.com/questions/47138241/…. Verify that the package is installed in the correct environment (the one your Python binary is part of), and that it includes files in directories that Python looks at (list those paths with
python -m site
). -
merv almost 2 yearsThe Conda package cache is not the same as the Python's
site-packages
. You shouldn't mess with these, otherwise you'll could end up with corruption complaints from Conda. -
merv almost 2 yearsThat is the package cache, which is not the same as
site-packages
for the Python installation.