AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |
Back to Blog
Anaconda install directory12/8/2023 I will list some stuff that you might do (though none is guaranteed but the last one - I'm just guessing): Ok, I found this under my history (but I don't remember reading it :D), and these. Sadly this is one thing I don't know much about (and damn, this region of python is messy. Can I somehow add the GitHub folder to my path permanently to accomplish this? I tried looking this up many times but couldn't make sense of any of the instructions, as few were made for Anaconda (which has its own weird path structure), and I couldn't understand any of those few. When I install something (say, matplotlib) from standard repositories using pip or conda, I can import it no matter where I'm working. I can only import the module if I either work in the GitHub directory or manually add it to the path in every notebook, using ('C:\Users\Me\Documents\GitHub').I would like to work in C:\Users\Me\Documents\DataAnalysis.I cloned the package to: C:\Users\Me\Documents\GitHub.Do you know how to make it so that I can be working somewhere else but still import it? The install works now, but I can't import the package unless my working directory is the one that contains the folder I cloned. The -e flags install the package in "editable" mode and follows whatever changes you make to it locally (not sure if you'll need to reload the Jupyter notebook though). You can check the Python version used at Jupyter notebook with import sys print(sys.executable).Īlso note: If you want to modify the package, modify the pip install command to $ python -m pip install -e Now, if the Jupyter notebook uses the same Python as the one above, the package should work flawlessly. To verify if the package has been installed successfully. '/path/to/anaconda/envs/ENV_NAME/lib/python3.8/site-packages/paho/_init_.py' If any errors occur here, consult the package docs or let us know $ python Use python -m pip instead of pip directly to guarantee that the correct version of Python is being used. This will install the package found at the directory / (which was just downloaded by the git command). can be replace with the URL to the package. Verify the correct Python is exposed (it should be related to anaconda or miniconda). $ python -c 'import sys print(sys.executable)' If you use only one environment, I believe it is called base. $ conda activate ENV_NAMEĮNV_NAME can be replaced by your conda env name. Here's an example from my machine (if you're on Windows, you'll probably want to do this on Anaconda prompt). Make sure you're on the conda environment before installing the package. TLDR: I can't figure out how to add a local directory to my (Anaconda-installed) python path. I recognize this is probably a very stupid problem but I'm at wit's end here. I try to do import packagename within a Jupyter notebook and just get ModuleNotFoundError: No module named 'packagename'Īny suggestions or ideas of what I'm doing wrong? I'd love to be able to just do pip (or conda) install 'package path within local GitHub directory' for future packages and just have it be done.I try whatever various things listed above to point Python to the right place.pip install "path to package" is successful.I can't even find where my Python path is actually stored for Anaconda.Įdit: To be clear, my process is usually as follows: I also tried conda develop 'Path to package' and it also doesn't work. pth files to C:\Users\Me\anaconda3\Lib\site-packages and to C:\Users\Me\anaconda3\envs\MyEnvName\Lib\site-packages. I've spent a bunch of time googling for solutions but they never work. This is rather annoying and inelegant-is it possible to just add my GitHub directory to my Python path? It seems obvious that I should be able to, but I can't for the life of me figure out how to do it in Anaconda, since it doesn't use the PYTHONPATH variable (in fact my system doesn't have one at all). I've previously gotten it to work by using setup.py install from inside the directory, then appending to the path using ('path to package') every time I start a Jupyter notebook. I want to install it into a conda environment. I've downloaded a Python package I want to use from GitHub using GitHub Desktop. Hi all, I'm going in circles here, maybe you can advise?
0 Comments
Read More
Leave a Reply. |