[chimerax-users] Python/Pip Inquiry - ChimeraX - Nathan Wood

Anthony James Schaefer tony.schaefer at uga.edu
Mon Jul 5 19:29:29 PDT 2021


Nathan,

I can't say why you're getting interpreter error. I think ChimeraX has to start up in order to set its package install destination, which might be why packages installed from the interpreter can't be found by ChimeraX.

You can try using `/path/to/ChimeraX-console -m pip install X`

You might also be able to download the package's .whl file from PyPI/conda and install it with the toolshed install /path/to/some.whl​ ChimeraX command - I've never tried this. However, the bundle API has a straightforward way of requesting other packages to be installed.

Bundles are easy to distribute, and you can list dependencies that will automatically be installed from PyPI when someone installs your bundle. There are examples and tutorials for creating a bundle on the developer tutorial you mentioned in your previous thread: https://www.cgl.ucsf.edu/chimerax/docs/devel/tutorials/introduction.html

As an example of how easy it is to specify PyPI dependencies for a bundle, here's some sections from the bundle_info.xml from my TestManager bundle:
```
​<BundleInfo name="ChimeraX_TestManager"
...some other stuff...
            <Dependencies>
                <Dependency name="ChimeraX-Core" version=">=1.1"/>
                <Dependency name="flake8"/>
                <Dependency name="pyflakes"/>
                <Dependency name="mypy"/>
                <Dependency name="pydocstyle"/>
            </Dependencies>
...some more stuff...
```

Now, whenever someone installs my TestManager bundle from the Toolshed or the .whl file, ChimeraX will go install flake8, pyflakes, mypy, and pydocstyle from PyPI as well. This is much easier for everyone involved than having to install all the dependencies manually.

If one of your dependencies is only on conda, perhaps you can package it with your bundle. The bundle_info.xml supports adding more modules to your bundle with the AdditionalPackages tag. Here's the full list of supported bundle_info.xml tags: https://www.rbvi.ucsf.edu/chimerax/docs/devel/tutorials/bundle_info.html

Best,

Tony
________________________________
From: ChimeraX-users <chimerax-users-bounces at cgl.ucsf.edu> on behalf of Nathan Wood via ChimeraX-users <chimerax-users at cgl.ucsf.edu>
Sent: Monday, July 5, 2021 9:16 PM
To: chimerax-users at cgl.ucsf.edu <chimerax-users at cgl.ucsf.edu>
Subject: [chimerax-users] Python/Pip Inquiry - ChimeraX - Nathan Wood

[EXTERNAL SENDER - PROCEED CAUTIOUSLY]


Dear ChimeraX


With regards to the python and pip utilities organic to ChimeraX, is it possible to use the conda installed modules within the same script executed by ChimeraX? When running the script through ChimeraX I return an error that the module is not found.

The module was installed using "pip install -e . " while in the conda environment. When I attempted this using the pip provided in ChimeraX Daily Release (22/06/2021, Generic X64 Linux) I return the error:

"/tmp/chx-develop.eKjBho/ChimeraX.app/bin/python3.8: bad interpreter: No such file or directory"

This error can be resolved if I modify the "#!" at the beginning of the pip in a text editor to the python3.8 found within ChimeraX, with pip installing correctly, but ChimeraX still returning that the module is not found. Furthermore I believe this method is not sound.


Any assistance would be appreciated


Very Respectfully,

Nathan Wood

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://plato.cgl.ucsf.edu/pipermail/chimerax-users/attachments/20210706/0f77b119/attachment.html>


More information about the ChimeraX-users mailing list