Basic NaCl "Import Error" when initialising

423 views
Skip to first unread message

J Twynham

unread,
Oct 28, 2020, 5:50:20 AM10/28/20
to westpa-users
Hi all,

When I run the init.sh, firstly I get the following message on stderr:
env.sh: line 7: activate: No such file or directory

After editing the env.sh to instead call:
source conda activate westpa-openmm-mdtraj

This then gives me this stderror.

import: unable to open X server `' @ error/import.c/ImportImageCommand/344.
/users/stxjt17/anaconda3/condabin/conda: line 6: syntax error near unexpected token `sys. argv'
/users/stxjt17/anaconda3/condabin/conda: line 6: `if len(sys.argv) > 1 and sys.argv[1].st
artswith('shell.') and sys.path and sys.path[0] == '':'

After this error, the script seems to run as normal, but it seems like the shell is calling import instead of Python. I'm not sure what to do next as my research leads me down a rabbit hole of conda and python issues.

Thanks,
Jordan

Anthony Bogetti

unread,
Oct 28, 2020, 12:44:08 PM10/28/20
to westpa...@googlegroups.com
Hi Justin,

There are a few things to try here.  One solution that should definitely work is to include a line in your env.sh where you manually source the westpa.sh that is in your conda environment.  That should take care of it and not give you any further issues.  I hesitate to suggest any other python/conda related fixes because those will vary depending on how the computing cluster you are using is set up.  However, in the past, the following have worked for me:

  • Make sure the line in your env.sh reads: conda activate westpa-openmm-mdtraj (I see that on Github it reads source activate instead, so try out using it with conda activate)

  • If you are able to on your computing resource, manually activate the conda environment from the command line (instead of from within the env.sh) before running init.sh and remove all mention of the conda activation from your env.sh

Alternatively, you can forego the conda install and install the WESTPA package manually in some local directory (you will still need access to an anaconda/miniconda installation somewhere).  

You mentioned that the rest of the script seems to run as normal, are you referring to the init.sh script?  If your system properly initializes, that indicates you are good to go regardless of any conda errors that come up, as everything WESTPA-related has been properly sourced (probably before init.sh was run).

Let me know if you run into any further issues or want more information regarding the options I mentioned above.

Best,
Anthony



--
You received this message because you are subscribed to the Google Groups "westpa-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to westpa-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/westpa-users/bb6d1085-d967-45a4-900a-57ce5c405511n%40googlegroups.com.

Anthony Bogetti

unread,
Oct 28, 2020, 2:33:31 PM10/28/20
to westpa...@googlegroups.com
Hi Jordan,

I just wanted to apologize for addressing the previous emails incorrectly, I seem to have gotten your name wrong.  Sorry about that.  Please let us know if you have any more difficulties setting up your simulation, we are happy to help.

Best,
Anthony

J Twynham

unread,
Oct 28, 2020, 3:18:16 PM10/28/20
to westpa-users
Hi Anthony,

Don't worry about mixing up my name, Im just happy for the help! All of the following commands were ran with the westpa conda environment manually enabled.

My env.sh called for conda activate, I tried this with simply "activate". I also commented out the source line entirely, both gave me the following error.
/users/stxjt17/anaconda3/envs/westpa-openmm-mdtraj/lib/python2.7/site-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
  from ._conv import register_converters as _register_converters
Traceback (most recent call last):
  File "/users/stxjt17/anaconda3/westpa-2020.03/lib/cmds/w_init.py", line 9, in <module>
    import work_managers
  File "/users/stxjt17/anaconda3/westpa-2020.03/lib/wwmgr/work_managers/__init__.py", line 17, in <module>
    from . import serial, threads, processes
  File "/users/stxjt17/anaconda3/westpa-2020.03/lib/wwmgr/work_managers/threads.py", line 4, in <module>
    import queue
ImportError: No module named queue


Thanks for your help,
Jordan

Anthony Bogetti

unread,
Oct 28, 2020, 3:41:42 PM10/28/20
to westpa...@googlegroups.com
Hi Jordan,

Could you send me your current simulation setup (you can tar or zip the directory) and your conda environment exported as a yaml file (conda env export --name ENVNAME > envname.yml)?  I’ll take a closer look and try to reproduce the error and then get back to you.

Thanks!
Anthony

J Twynham

unread,
Oct 29, 2020, 5:54:34 AM10/29/20
to westpa-users
Hi Anthony,

Thank you for working with me on this! Apologies for the late reply, but I think we are working in different time zones!
I've attached my current set up to this post. Let me know if you need anything further. I'll continue my debugging throughout the day and I will report back if I make any progress.

Thanks!
Jordan
simulation_setup.zip
westpa-openmm-mdtraj.yml

J Twynham

unread,
Oct 29, 2020, 6:40:45 AM10/29/20
to westpa-users
Hi Anthony,

A little update. I changed the activation line in my env.sh to:
conda activate westpa-openmm-mdtraj
This now gives me the following output (ran after manually activating the conda base env):

Stderr:
CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.

To initialize your shell, run
   $ conda init <SHELL_NAME>
Currently supported shells are:
 - bash
 - fish
 - tcsh
 - xonsh
 - zsh
 - powershell

See 'conda init --help' for more information and options.
IMPORTANT: You may need to close and restart your shell after running 'conda init'.

Stdout:

Updating system with the options from the configuration file
Creating HDF5 file '/users/stxjt17/westpa_tutorials/basic_nacl/west.h5'
1 target state(s) present
Calculating progress coordinate values for basis states.
1 basis state(s) present
Preparing initial states

       Total bins:            22
       Initial replicas:      5 in 1 bins, total weight = 1
       Total target replicas: 110
        
Simulation prepared.
1 of 22 (4.545455%) active bins are populated
per-bin minimum non-zero probability:       1
per-bin maximum probability:                1
per-bin probability dynamic range (kT):     0
per-segment minimum non-zero probability:   0.2
per-segment maximum non-zero probability:   0.2
per-segment probability dynamic range (kT): 0
norm = 1, error in norm = 0 (0*epsilon)

Am I correct in thinking that the init.sh script has initialized the simulation correctly? The stderr is giving me doubts, but the stdout seems to indicate all is well.

Best wishes,

Jordan

J Twynham

unread,
Oct 29, 2020, 7:50:39 AM10/29/20
to westpa-users
New update (sorry for the multiple messages)
When running the init.sh script with bash -i, there is no stderr and the following stdout:
mkdir: created directory ‘seg_logs’
mkdir: created directory ‘traj_segs’
mkdir: created directory ‘istates’
Updating system with the options from the configuration file
Creating HDF5 file '/users/stxjt17/westpa_tutorials/basic_nacl/west.h5'
1 target state(s) present
Calculating progress coordinate values for basis states.
1 basis state(s) present
Preparing initial states

       Total bins:            22
       Initial replicas:      5 in 1 bins, total weight = 1
       Total target replicas: 110
        
Simulation prepared.

I believe this has resolved this issue (I hope :)), but it would be interesting to work out why this seems to fix the error - it may be worth issuing a pull request to the wiki to mention that this is a possible fix for some users

Best wishes,
Jordan

Anthony Bogetti

unread,
Oct 29, 2020, 1:20:08 PM10/29/20
to westpa...@googlegroups.com
Hi Jordan,

That output indicates that the simulation was successfully initialized!  WESTPA is properly finding everything it needs.  If you activate the conda environment manually from the command line and then run init.sh (no conda activation in the env.sh), does the simulation still initialize properly?  Removing that line may fix the errors that are being printed, and as long as WESTPA has been sourced properly before running init.sh everything may be fine.

Best,
Anthony

J Twynham

unread,
Oct 30, 2020, 5:39:19 AM10/30/20
to westpa-users
Hi Anthony,

Great news!
Just reporting in to let you know that when the env is manually activated from the shell and init.sh is ran without conda activation in the env.sh, the simulation fails to initalize.
Stdout:

mkdir: created directory ‘seg_logs’
mkdir: created directory ‘traj_segs’
mkdir: created directory ‘istates’

/users/stxjt17/anaconda3/envs/westpa-openmm-mdtraj/lib/python2.7/site-packages/h5py/__ini


t__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to
`np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(fl
oat).type`.
 from ._conv import register_converters as _register_converters
Traceback (most recent call last):
 File "/users/stxjt17/anaconda3/westpa-2020.03/lib/cmds/w_init.py", line 9, in <module>
   import work_managers
 File "/users/stxjt17/anaconda3/westpa-2020.03/lib/wwmgr/work_managers/__init__.py", lin
e 17, in <module>
   from . import serial, threads, processes
 File "/users/stxjt17/anaconda3/westpa-2020.03/lib/wwmgr/work_managers/threads.py", line
4, in <module>
   import queue
ImportError: No module named queue

Thanks,
Jordan

Anthony Bogetti

unread,
Nov 2, 2020, 11:00:54 AM11/2/20
to westpa...@googlegroups.com
Hi Jordan,

Thanks for the update!  I’m glad things are working for you now.  In the future, we will look more into the different ways that users are able to activate the conda environment and try to make the process more streamlined.  The error messages you provided will be very helpful.

Best,
Anthony

Reply all
Reply to author
Forward
0 new messages