Opened 2 years ago
Closed 2 years ago
#8927 closed defect (fixed)
'pip install mdtraj' from ChimeraX command line gives error
| Reported by: | Zach Pearson | Owned by: | Zach Pearson |
|---|---|---|---|
| Priority: | moderate | Milestone: | |
| Component: | Build System | Version: | |
| Keywords: | Cc: | barry.dezonia@…, Greg Couch | |
| Blocked By: | Blocking: | ||
| Notify when closed: | Platform: | all | |
| Project: | ChimeraX |
Description
User indicated over email that their bundle is likely to be Linux only, but the installation error was observed on macOS. Should retry on a Linux machine to verify the bug crops up where it matters.
Change History (13)
follow-up: 1 comment:1 by , 2 years ago
follow-up: 2 comment:2 by , 2 years ago
That was using UCSF ChimeraX version: 1.6rc202304202331 (2023-04-20) on Linux (Ubuntu 20.04)
________________________________
From: ChimeraX <ChimeraX-bugs-admin@cgl.ucsf.edu>
Sent: Monday, May 1, 2023 12:31 PM
To: zjp@cgl.ucsf.edu <zjp@cgl.ucsf.edu>
Cc: BARRY E DEZONIA <barry.dezonia@wisc.edu>
Subject: Re: [ChimeraX] #8927: 'pip install mdtraj' from ChimeraX command line gives error
#8927: 'pip install mdtraj' from ChimeraX command line gives error
-----------------------------------+--------------------------
Reporter: Zach Pearson | Owner: Zach Pearson
Type: defect | Status: assigned
Priority: moderate | Milestone:
Component: Build System | Version:
Resolution: | Keywords:
Blocked By: | Blocking:
Notify when closed: | Platform: all
Project: ChimeraX |
-----------------------------------+--------------------------
Comment (by barry.dezonia@…):
{{{
FYI I (the original user who reported the bug) have run "pip install
mdtraj" from the Command: field in chimerax 1.6 rc version from last week
and get this error:
open /usr/lib/ucsf-chimerax/lib/python3.9/site-packages/pip/__pip-
runner__.pyTraceback (most recent call last):
File "/usr/lib/ucsf-chimerax/lib/python3.9/site-packages/pip/__pip-
runner__.py", line 49, in <module>
assert __name__ == "__main__", "Cannot run __pip-runner__.py as a non-main
module"
AssertionError: Cannot run __pip-runner__.py as a non-main module
Error opening python file /usr/lib/ucsf-chimerax/lib/python3.9/site-
packages/pip/__pip-runner__.py
After that I get a bunch of errors where it seems like the previous
command line got chopped into pieces and the rest of the command is run as
a bunch of other consecutive commands:
open install'install' has no suffix
open --ignore-installed'--ignore-installed' has no suffix
open --no-user'--no-user' has no suffix
open --prefix'--prefix' has no suffix
open /tmp/pip-build-env-lr33t5yk/overlay'/tmp/pip-build-env-
lr33t5yk/overlay' has no suffix
open --no-warn-script-location'--no-warn-script-location' has no suffix
open --no-binary'--no-binary' has no suffix
open :none:':none:' has no suffix
open --only-binary'--only-binary' has no suffix
open :none:':none:' has no suffix
open -i'-i' has no suffix
open https://pypi.org/simpleOpened https://pypi.org/simple
open --'--' has no suffix
open setuptools'setuptools' has no suffix
open wheel'wheel' has no suffix
open "numpy==1.11.3; python_version=='3.6'"Unrecognized file suffix '.6''
open "numpy==1.14.6; python_version=='3.7'"Unrecognized file suffix '.7''
open "numpy==1.17.5; python_version=='3.8'"Unrecognized file suffix '.8''
open "numpy==1.19.5; python_version=='3.9'"Unrecognized file suffix '.9''
open "numpy==1.21.3; python_version=='3.10'"Unrecognized file suffix
'.10''
open "numpy; python_version>='3.11'"Unrecognized file suffix '.11''
open Cython>0.28Unrecognized file suffix '.28'
________________________________
From: ChimeraX <ChimeraX-bugs-admin@cgl.ucsf.edu>
Sent: Monday, May 1, 2023 12:16 PM
Cc: BARRY E DEZONIA <barry.dezonia@wisc.edu>; zjp@cgl.ucsf.edu
<zjp@cgl.ucsf.edu>
Subject: [ChimeraX] #8927: 'pip install mdtraj' from ChimeraX command line
gives error
#8927: 'pip install mdtraj' from ChimeraX command line gives error
--------------------------+-----------------------------------
Reporter: Zach Pearson | Owner: Zach Pearson
Type: defect | Status: assigned
Priority: moderate | Milestone:
Component: Build System | Version:
Keywords: | Blocked By:
Blocking: | Notify when closed:
Platform: all | Project: ChimeraX
--------------------------+-----------------------------------
User indicated over email that their bundle is likely to be Linux only,
but the installation error was observed on macOS. Should retry on a Linux
machine to verify the bug crops up where it matters.
--
Ticket URL: <https://www.rbvi.ucsf.edu/trac/ChimeraX/ticket/8927>
ChimeraX <https://www.rbvi.ucsf.edu/chimerax/>
ChimeraX Issue Tracker
}}}
--
Ticket URL: <https://www.rbvi.ucsf.edu/trac/ChimeraX/ticket/8927#comment:1>
ChimeraX <https://www.rbvi.ucsf.edu/chimerax/>
ChimeraX Issue Tracker
follow-up: 3 comment:3 by , 2 years ago
Sorry to ask but is fixing this issue any sort of priority? My programming project is blocked until this is fixed. If it can't be fixed soon I will need to write an external app that drives/is driven by chimerax instead.
________________________________
From: ChimeraX <ChimeraX-bugs-admin@cgl.ucsf.edu>
Sent: Monday, May 1, 2023 12:34 PM
To: zjp@cgl.ucsf.edu <zjp@cgl.ucsf.edu>
Cc: BARRY E DEZONIA <barry.dezonia@wisc.edu>
Subject: Re: [ChimeraX] #8927: 'pip install mdtraj' from ChimeraX command line gives error
#8927: 'pip install mdtraj' from ChimeraX command line gives error
-----------------------------------+--------------------------
Reporter: Zach Pearson | Owner: Zach Pearson
Type: defect | Status: assigned
Priority: moderate | Milestone:
Component: Build System | Version:
Resolution: | Keywords:
Blocked By: | Blocking:
Notify when closed: | Platform: all
Project: ChimeraX |
-----------------------------------+--------------------------
Comment (by barry.dezonia@…):
{{{
That was using UCSF ChimeraX version: 1.6rc202304202331 (2023-04-20) on
Linux (Ubuntu 20.04)
________________________________
From: ChimeraX <ChimeraX-bugs-admin@cgl.ucsf.edu>
Sent: Monday, May 1, 2023 12:31 PM
To: zjp@cgl.ucsf.edu <zjp@cgl.ucsf.edu>
Cc: BARRY E DEZONIA <barry.dezonia@wisc.edu>
Subject: Re: [ChimeraX] #8927: 'pip install mdtraj' from ChimeraX command
line gives error
#8927: 'pip install mdtraj' from ChimeraX command line gives error
-----------------------------------+--------------------------
Reporter: Zach Pearson | Owner: Zach Pearson
Type: defect | Status: assigned
Priority: moderate | Milestone:
Component: Build System | Version:
Resolution: | Keywords:
Blocked By: | Blocking:
Notify when closed: | Platform: all
Project: ChimeraX |
-----------------------------------+--------------------------
Comment (by barry.dezonia@…):
{{{
FYI I (the original user who reported the bug) have run "pip install
mdtraj" from the Command: field in chimerax 1.6 rc version from last week
and get this error:
open /usr/lib/ucsf-chimerax/lib/python3.9/site-packages/pip/__pip-
runner__.pyTraceback (most recent call last):
File "/usr/lib/ucsf-chimerax/lib/python3.9/site-packages/pip/__pip-
runner__.py", line 49, in <module>
assert __name__ == "__main__", "Cannot run __pip-runner__.py as a non-
main
module"
AssertionError: Cannot run __pip-runner__.py as a non-main module
Error opening python file /usr/lib/ucsf-chimerax/lib/python3.9/site-
packages/pip/__pip-runner__.py
After that I get a bunch of errors where it seems like the previous
command line got chopped into pieces and the rest of the command is run
as
a bunch of other consecutive commands:
open install'install' has no suffix
open --ignore-installed'--ignore-installed' has no suffix
open --no-user'--no-user' has no suffix
open --prefix'--prefix' has no suffix
open /tmp/pip-build-env-lr33t5yk/overlay'/tmp/pip-build-env-
lr33t5yk/overlay' has no suffix
open --no-warn-script-location'--no-warn-script-location' has no suffix
open --no-binary'--no-binary' has no suffix
open :none:':none:' has no suffix
open --only-binary'--only-binary' has no suffix
open :none:':none:' has no suffix
open -i'-i' has no suffix
open https://pypi.org/simpleOpened https://pypi.org/simple
open --'--' has no suffix
open setuptools'setuptools' has no suffix
open wheel'wheel' has no suffix
open "numpy==1.11.3; python_version=='3.6'"Unrecognized file suffix '.6''
open "numpy==1.14.6; python_version=='3.7'"Unrecognized file suffix '.7''
open "numpy==1.17.5; python_version=='3.8'"Unrecognized file suffix '.8''
open "numpy==1.19.5; python_version=='3.9'"Unrecognized file suffix '.9''
open "numpy==1.21.3; python_version=='3.10'"Unrecognized file suffix
'.10''
open "numpy; python_version>='3.11'"Unrecognized file suffix '.11''
open Cython>0.28Unrecognized file suffix '.28'
________________________________
From: ChimeraX <ChimeraX-bugs-admin@cgl.ucsf.edu>
Sent: Monday, May 1, 2023 12:16 PM
Cc: BARRY E DEZONIA <barry.dezonia@wisc.edu>; zjp@cgl.ucsf.edu
<zjp@cgl.ucsf.edu>
Subject: [ChimeraX] #8927: 'pip install mdtraj' from ChimeraX command
line
gives error
#8927: 'pip install mdtraj' from ChimeraX command line gives error
--------------------------+-----------------------------------
Reporter: Zach Pearson | Owner: Zach Pearson
Type: defect | Status: assigned
Priority: moderate | Milestone:
Component: Build System | Version:
Keywords: | Blocked By:
Blocking: | Notify when closed:
Platform: all | Project: ChimeraX
--------------------------+-----------------------------------
User indicated over email that their bundle is likely to be Linux only,
but the installation error was observed on macOS. Should retry on a
Linux
machine to verify the bug crops up where it matters.
--
Ticket URL: <https://www.rbvi.ucsf.edu/trac/ChimeraX/ticket/8927>
ChimeraX <https://www.rbvi.ucsf.edu/chimerax/>
ChimeraX Issue Tracker
}}}
--
Ticket URL:
<https://www.rbvi.ucsf.edu/trac/ChimeraX/ticket/8927#comment:1>
ChimeraX <https://www.rbvi.ucsf.edu/chimerax/>
ChimeraX Issue Tracker
}}}
--
Ticket URL: <https://www.rbvi.ucsf.edu/trac/ChimeraX/ticket/8927#comment:2>
ChimeraX <https://www.rbvi.ucsf.edu/chimerax/>
ChimeraX Issue Tracker
comment:4 by , 2 years ago
Yes, we are looking into it. We'd like to get it working either way, but have you tried seeing if your dependency works if you make your project a bundle and add mdtraj as a dependency?
follow-up: 5 comment:5 by , 2 years ago
I have only dabbled. I will make that a focus next week.
________________________________
From: ChimeraX <ChimeraX-bugs-admin@cgl.ucsf.edu>
Sent: Thursday, May 4, 2023 6:45 PM
Cc: BARRY E DEZONIA <barry.dezonia@wisc.edu>; zjp@cgl.ucsf.edu <zjp@cgl.ucsf.edu>
Subject: Re: [ChimeraX] #8927: 'pip install mdtraj' from ChimeraX command line gives error
#8927: 'pip install mdtraj' from ChimeraX command line gives error
-----------------------------------+--------------------------
Reporter: Zach Pearson | Owner: Zach Pearson
Type: defect | Status: assigned
Priority: moderate | Milestone:
Component: Build System | Version:
Resolution: | Keywords:
Blocked By: | Blocking:
Notify when closed: | Platform: all
Project: ChimeraX |
-----------------------------------+--------------------------
Comment (by Zach Pearson):
Yes, we are looking into it. We'd like to get it working either way, but
have you tried seeing if your dependency works if you make your project a
bundle and add mdtraj as a dependency?
--
Ticket URL: <https://www.rbvi.ucsf.edu/trac/ChimeraX/ticket/8927#comment:4>
ChimeraX <https://www.rbvi.ucsf.edu/chimerax/>
ChimeraX Issue Tracker
comment:6 by , 2 years ago
| Cc: | added |
|---|---|
| Owner: | changed from to |
Greg, is there any reason to require pip to go through the ChimeraX executable? As you suspected the pip team don't want pip to be run as a subprocess. 'pip install mdtraj' works when I launch ChimeraX with my debugger, but not from the ChimeraX executable because we detect the executable and use "python3.9 -I -m chimerax.core -m pip" instead.
comment:7 by , 2 years ago
Yes. The reason is the path to the "user" location. The user should not be installing packages to the system location for many reasons. First of all, the user should not have permission. That is enforced by Windows and Linux by using the system to install the application. Not sure about Macs, but there the files are signed, so installing in the system location would break the signature.
The -I option might be messing things up -- it contraindicates having a user location, since the user's site-packages location is not added to sys.path. ChimeraX does an implicit -I, but compensates for it. Using Linux as an example and ignoring the -I: "python3.9 -m pip install --user" installs in ~/.local/lib/python3.9/site-packages and those packages are available to any Python 3.9 invocation, ChimeraX's or not. "ChimeraX -m pip install --user" installs in ~.local/share/ChimeraX/1.6/site-packages" and those packages are only available to ChimeraX.
comment:8 by , 2 years ago
OK, makes sense to me. In my developer build I get a little bit more detailed of a traceback than what's in this ticket. For some reason, opts.module is not being set to pip, so we're using the other (script?) path at lines 783-800 instead of the module path which would set the run_name to __main__.
Collecting mdtraj
Using cached mdtraj-1.9.7.tar.gz (2.1 MB)
Installing build dependencies: started
Installing build dependencies: finished with status 'error'
error: subprocess-exited-with-error
× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> [30 lines of output]
ERROR:
Traceback (most recent call last):
File "/home/zjp/git/rbvi/ChimeraX/ChimeraX.app/lib/python3.9/runpy.py", line
197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/home/zjp/git/rbvi/ChimeraX/ChimeraX.app/lib/python3.9/runpy.py", line
87, in _run_code
exec(code, run_globals)
File "/home/zjp/git/rbvi/ChimeraX/src/bundles/core/src/__main__.py", line
1043, in <module>
exit_code = init(sys.argv)
File "/home/zjp/git/rbvi/ChimeraX/src/bundles/core/src/__main__.py", line
800, in init
runpy.run_path(opts.run_path)
File "/home/zjp/git/rbvi/ChimeraX/ChimeraX.app/lib/python3.9/runpy.py", line
268, in run_path
return _run_module_code(code, init_globals, run_name,
File "/home/zjp/git/rbvi/ChimeraX/ChimeraX.app/lib/python3.9/runpy.py", line
97, in _run_module_code
_run_code(code, mod_globals, init_globals,
File "/home/zjp/git/rbvi/ChimeraX/ChimeraX.app/lib/python3.9/runpy.py", line
87, in _run_code
exec(code, run_globals)
File "/home/zjp/git/rbvi/ChimeraX/ChimeraX.app/lib/python3.9/site-
packages/pip/__pip-runner__.py", line 49, in <module>
assert __name__ == "__main__", "Cannot run __pip-runner__.py as a non-main
module"
AssertionError: Cannot run __pip-runner__.py as a non-main module
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error
× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
[notice] A new release of pip is available: 23.0 -> 23.1.2
[notice] To update, run: /home/zjp/git/rbvi/ChimeraX/ChimeraX.app/bin/ChimeraX -m pip install --upgrade pip
comment:9 by , 2 years ago
pip is correctly set as the module but when it calls itself (via pip-runner.py) we think it's a script and act accordingly. Maybe at line 800 we need to check if the script is pip-runner.py and call it with Python or ChimeraX instead of trying to directly run the script itself.
comment:10 by , 2 years ago
| Cc: | added; removed |
|---|---|
| Owner: | changed from to |
Zach is taking this on. Give him credit.
comment:11 by , 2 years ago
I think it would be a good idea to set the PYTHONUSERBASE environment variable to the value of chimerax.app_dirs.user_data_dir or use the --prefix flag with the same value in calls to pip.
This will make pip install packages, binaries, and data to ~/.local/share/ChimeraX/1.6/{bin,lib,share}, and we can symbolically link ~/.local/share/ChimeraX/1.6/lib/python3.x/site-packages to ~/.local/share/ChimeraX/1.6/site-packages.
Either of these solutions sidestep the need for us to improve our handling of recursive calls to pip.
comment:12 by , 2 years ago
Using the above solution I was able to install mdtraj from the ChimeraX command line; it went into the correct directory (and I made a symlink to the old one, which isn't programmatic yet) and its associated binaries mdconvert and mdinspect were placed in ~/.local/share/ChimeraX/1.6/bin.
comment:13 by , 2 years ago
| Resolution: | → fixed |
|---|---|
| Status: | assigned → closed |
OK, I've merged a solution as this commit. Note that this will not work with the recently released ChimeraX 1.6 -- you will have to use the daily build to install mdtraj from the ChimeraX command line.
We still strongly discourage releasing codes that require users to install dependencies by hand, so our advice to make a bundle that can be released on the ChimeraX Toolshed stands. If you need assistance you can email chimerax-users@… or me directly at zjp@…
FYI I (the original user who reported the bug) have run "pip install mdtraj" from the Command: field in chimerax 1.6 rc version from last week and get this error: open /usr/lib/ucsf-chimerax/lib/python3.9/site-packages/pip/__pip-runner__.pyTraceback (most recent call last): File "/usr/lib/ucsf-chimerax/lib/python3.9/site-packages/pip/__pip-runner__.py", line 49, in <module> assert __name__ == "__main__", "Cannot run __pip-runner__.py as a non-main module" AssertionError: Cannot run __pip-runner__.py as a non-main module Error opening python file /usr/lib/ucsf-chimerax/lib/python3.9/site-packages/pip/__pip-runner__.py After that I get a bunch of errors where it seems like the previous command line got chopped into pieces and the rest of the command is run as a bunch of other consecutive commands: open install'install' has no suffix open --ignore-installed'--ignore-installed' has no suffix open --no-user'--no-user' has no suffix open --prefix'--prefix' has no suffix open /tmp/pip-build-env-lr33t5yk/overlay'/tmp/pip-build-env-lr33t5yk/overlay' has no suffix open --no-warn-script-location'--no-warn-script-location' has no suffix open --no-binary'--no-binary' has no suffix open :none:':none:' has no suffix open --only-binary'--only-binary' has no suffix open :none:':none:' has no suffix open -i'-i' has no suffix open https://pypi.org/simpleOpened https://pypi.org/simple open --'--' has no suffix open setuptools'setuptools' has no suffix open wheel'wheel' has no suffix open "numpy==1.11.3; python_version=='3.6'"Unrecognized file suffix '.6'' open "numpy==1.14.6; python_version=='3.7'"Unrecognized file suffix '.7'' open "numpy==1.17.5; python_version=='3.8'"Unrecognized file suffix '.8'' open "numpy==1.19.5; python_version=='3.9'"Unrecognized file suffix '.9'' open "numpy==1.21.3; python_version=='3.10'"Unrecognized file suffix '.10'' open "numpy; python_version>='3.11'"Unrecognized file suffix '.11'' open Cython>0.28Unrecognized file suffix '.28' ________________________________ From: ChimeraX <ChimeraX-bugs-admin@cgl.ucsf.edu> Sent: Monday, May 1, 2023 12:16 PM Cc: BARRY E DEZONIA <barry.dezonia@wisc.edu>; zjp@cgl.ucsf.edu <zjp@cgl.ucsf.edu> Subject: [ChimeraX] #8927: 'pip install mdtraj' from ChimeraX command line gives error #8927: 'pip install mdtraj' from ChimeraX command line gives error --------------------------+----------------------------------- Reporter: Zach Pearson | Owner: Zach Pearson Type: defect | Status: assigned Priority: moderate | Milestone: Component: Build System | Version: Keywords: | Blocked By: Blocking: | Notify when closed: Platform: all | Project: ChimeraX --------------------------+----------------------------------- User indicated over email that their bundle is likely to be Linux only, but the installation error was observed on macOS. Should retry on a Linux machine to verify the bug crops up where it matters. -- Ticket URL: <https://www.rbvi.ucsf.edu/trac/ChimeraX/ticket/8927> ChimeraX <https://www.rbvi.ucsf.edu/chimerax/> ChimeraX Issue Tracker