Python Package Manger: How do I install a package that isn't listed?

701
6
Jump to solution
02-19-2021 08:31 AM
MichaelMorisette
New Contributor III

It appears the available packages to install in Pro is some form of curated list.  Is there a way to get this to show everything available in the python package index?

There is a particular package I'm after (python-docx) that isn't listed, and that I'm desiring for a python toolbox tool I'm working on.  If I'm unable to install it the clean way, what would be the best workaround of getting it into my Pro Python environment?

0 Kudos
1 Solution

Accepted Solutions
DanPatterson
MVP Esteemed Contributor

It isn't in esri's or anacondas default channels, so you could use a conda install (run proenv.bat) and try to install it from the conda-forge channel... failing that, there is always pip install.

If you are uncomfortable with any of these suggestions, then you might want to consider where it is a "need" versus a "nice".  You can do a lot of damage if you get things wrong... clone or not.


... sort of retired...

View solution in original post

6 Replies
JeffK
by MVP Regular Contributor
MVP Regular Contributor

You need to create a clone and then you can add packages. 

I've had problems with pro's use of conda installing packages (just spins and doesn't do anything) so I add the cloned environment to my list of interpreters in pycharm and add them through there. Sometimes I have to turn off the conda package manager for it to give me the pypi repo. I don't know the specifics behind the scenes, but it allows me to install packages. 

... Have they let us name the cloned environments yet?

0 Kudos
JoeBorgione
MVP Esteemed Contributor

... Have they let us name the cloned environments yet?

They meaning the ESRI ArcGIS Pro cloning methodology?  The answer is yes.  I treat clones as disposable so if something goes south with one I delete and re-clone.  In the image below, you'll see that I have a directory in C: called 'EnvClones' where I write them to.

JoeBorgione_0-1613764124799.png

This is what my C:\EnvClones looks like in file explorer:

JoeBorgione_1-1613764213863.png

The MiniConda isn't really a clone but rather a python environment I created with a Miniconda install.

 

That should just about do it....
JeffK
by MVP Regular Contributor
MVP Regular Contributor

Cool, thanks Joe. I haven't touched the environments since 2.4 and I remember it was frustrating to have ...clone_1, ...clone_2, ...clone_3 and not being able to tell what they were for.  

0 Kudos
DanPatterson
MVP Esteemed Contributor

It isn't in esri's or anacondas default channels, so you could use a conda install (run proenv.bat) and try to install it from the conda-forge channel... failing that, there is always pip install.

If you are uncomfortable with any of these suggestions, then you might want to consider where it is a "need" versus a "nice".  You can do a lot of damage if you get things wrong... clone or not.


... sort of retired...
MichaelMorisette
New Contributor III

This got me going.  Thanks!  proenv.bat was the missing link I needed.

Upon doing a conda install ... and resolving the dependencies, I discovered the likely reason my package wasn't listed in default repositories:  it resulted in having to downgrade one of the built-in packages!  Luckily, so far, this doesn't appear to have messed anything up for me in my clone environment.

Regarding "need" vs "nice," this definitely falls under the nice category.  My project is to author a tool that creates a PDF packet containing a formal letter with an attached map, based on user input.  My thought was to utilize a company letterhead template we have, versus recreating it from scratch (The python-docx package allows for manipulation of Microsoft Word documents).  However, the template is fairly simple so it won't be too cumbersome to just code it using reportlab or something similar.

0 Kudos
JoeBorgione
MVP Esteemed Contributor

I know Dan isn't a big fan of clones, but I do them all the time, and I have a few python environments that serve different purposes for me.

When it comes to adding packages to an ArcGIS Pro clone, I typically use

conda install <packageName>

rather than using the installer provided in ArcGIS Pro. In fact I haven't used that approach since yesterday. when I installed spyder in my latest pro 2.7 clone.

This is my go to conda command document:   

https://conda.io/projects/conda/en/latest/_downloads/843d9e0198f2a193a3484886fa28163c/conda-cheatshe...

That should just about do it....
0 Kudos