Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NameError: global name 'EMANVERSION' is not defined #137

Closed
jianhaoc opened this issue Oct 27, 2017 · 10 comments
Closed

NameError: global name 'EMANVERSION' is not defined #137

jianhaoc opened this issue Oct 27, 2017 · 10 comments

Comments

@jianhaoc
Copy link

Hi specialists,

I am trying install EMAN2.2 (centos6 or centos7 version). But when I ran e2display.py and failed with a error as following.

$ e2display.py
Traceback (most recent call last):
File "/home/jianhaoc/s/EMAN22centos6/bin/e2display.py", line 34, in
from EMAN2 import EMANVERSION, E2init, E2end, EMData, base_name, file_exists, EMArgumentParser
ImportError: cannot import name EMANVERSION

I tried other programmes. e2proc3d.py is ok for both versions, but e2proc2d.py or e2reliontoeman.py didn't work for neither versions.

$ e2reliontoeman.py --help
Traceback (most recent call last):
File "/home/jianhaoc/s/EMAN22centos7/bin/e2reliontoeman.py", line 157, in
main()
File "/home/jianhaoc/s/EMAN22centos7/bin/e2reliontoeman.py", line 56, in main
parser = EMArgumentParser(usage=usage,version=EMANVERSION)
NameError: global name 'EMANVERSION' is not defined

$ e2proc2d.py --help
Traceback (most recent call last):
File "/home/jianhaoc/s/EMAN22centos6/bin/e2proc2d.py", line 1171, in
main()
File "/home/jianhaoc/s/EMAN22centos6/bin/e2proc2d.py", line 174, in main
parser = EMArgumentParser(usage=usage,version=EMANVERSION)
NameError: global name 'EMANVERSION' is not defined

Am I missing something? Thank you!

Regards,
Jianhao

@sludtke42
Copy link
Member

sludtke42 commented Oct 27, 2017 via email

@jianhaoc
Copy link
Author

Hi Steve
Sorry for missing that. I also remember that, but googlegroup or gmail is unavailable these days. So I tried both these two versions. The detail informations are attached.

Regards,
Jianhao

For centos6 version
$ e2version.py
EMAN 2.2 (GITHUB: 2017-09-20 00:31 - commit: None )
Your EMAN2 is running on: Linux-2.6.32-573.12.1.el6_lustre.x86_64-x86_64-with-centos-6.7-Final 2.6.32-573.12.1.el6_lustre.x86_64
Your Python version is: 2.7.13

For centos7 version
$ e2version.py
EMAN 2.2 (GITHUB: 2017-09-20 00:00 - commit: 4aa69dd )
Your EMAN2 is running on: Linux-2.6.32-573.12.1.el6_lustre.x86_64-x86_64-with-centos-6.7-Final 2.6.32-573.12.1.el6_lustre.x86_64
Your Python version is: 2.7.13

for centos6 version
$ e2proc2d.py --help
Traceback (most recent call last):
File "/home/jianhaoc/s/EMAN22centos6/bin/e2proc2d.py", line 1171, in
main()
File "/home/jianhaoc/s/EMAN22centos6/bin/e2proc2d.py", line 174, in main
parser = EMArgumentParser(usage=usage,version=EMANVERSION)
NameError: global name 'EMANVERSION' is not defined

$ e2reliontoeman.py --help
Traceback (most recent call last):
File "/home/jianhaoc/s/EMAN22centos6/bin/e2reliontoeman.py", line 157, in
main()
File "/home/jianhaoc/s/EMAN22centos6/bin/e2reliontoeman.py", line 56, in main
parser = EMArgumentParser(usage=usage,version=EMANVERSION)
NameError: global name 'EMANVERSION' is not defined

$ e2proc3d.py --help
Usage: e2proc3d.py [options]
Generic 3-D image processing and file format conversion program.
All EMAN2 recognized file formats accepted (see Wiki for list).

To create a new image, rather than reading from a file, specify ':<nx>:<ny>:<nz>:<value>'
as an input filename.

Examples:

Convert MRC format to HDF format:
e2proc3d.py test.mrc test.hdf

Apply a 10 A low-pass filter to a volume and write output to a new file:
e2proc3d.py threed.hdf threed.filt.hdf --process=filter.lowpass.gauss:cutoff_freq=0.1

Extract a reconstruction from a refinement directory as an HDF file usable with Chimera:
e2proc3d.py bdb:refine_02#threed_filt_04 map_02_04.hdf

Create a new 64x64x64 volume, initialize it as 1, then apply a hard spherical mask to 0:
e2proc3d.py :64:64:64:1 myvol.hdf --process mask.sharp:outer_radius=25

'e2help.py processors -v 2' for a detailed list of available procesors

Options:
-h, --help show this help message and exit
--medianshrink=n Downsamples the volume by a factor of n by computing
the local median
--meanshrink=n Downsamples the volume by a factor of n by computing
the local average
--meanshrinkbig=n Downsamples the volume by a factor of n without
reading the entire volume into RAM. The output file
(after shrinking) must fit into RAM. If specified,
this must be the ONLY option on the command line. Any
other options will be ignored. Output data type will
match input data type. Works only on single image
files, not stack files.
--scale=n Rescales the image by 'n', generally used with clip
option.
--sym=SYM Symmetry to impose - choices are: c, d, h,
tet, oct, icos
--averager=AVERAGER Averager used for --average and --sym options
--clip=x[,y,z[,xc,yc,zc]]
Make the output have this size by padding/clipping. 1,
3 or 6 arguments.
--fftclip=x, y, z Make the output have this size, rescaling by padding
FFT.
--process=processor_name:param1=value1:param2=value2
apply a processor named 'processorname' with all its
parameters/values.
--apix=APIX A/pixel for S scaling
--origin=x, y, z Set the coordinates for the pixel (0,0,0) for Chimera.
THIS HAS NO IMPACT ON IMAGE PROCESSING !
--mult=f Scales the densities by a fixed number in the output
--multfile=MULTFILE Multiplies the volume by another volume of identical
size. This can be used to apply masks, etc.
--matchto=MATCHTO Match filtration of input volume to this specified
volume.
--outmode=OUTMODE All EMAN2 programs write images with 4-byte floating
point values when possible by default. This allows
specifying an alternate format when supported (int8,
int16, int32, uint8, uint16, uint32). Values are
rescaled to fill MIN-MAX range.
--outnorescale If specified, floating point values will not be
rescaled when writing data as integers. Values outside
of range are truncated.
--mrc16bit (deprecated, use --outmode instead) output as 16 bit
MRC file
--mrc8bit (deprecated, use --outmode instead) output as 8 bit
MRC file
--add=f Adds a constant 'f' to the densities
--addfile=ADDFILE Adds the volume to another volume of identical size
--calcfsc=with input Calculate a FSC curve between two models. Output is a
txt file. This option is the name of the second
volume.
--filtertable=FILTERTABLE
Applies a 2 column (S,amp) file as a filter in Fourier
space, assumed 0 outside the defined range.
--calcsf=outputfile Calculate a radial structure factor. Must specify
apix.
--calcradial=CALCRADIAL
Calculate the radial density by shell. Output file
becomes a text file. 0 - mean amp, 2 - min, 3 - max, 4
- sigma
--setsf=inputfile Set the radial structure factor. Must specify apix.
--tophalf The output only keeps the top half map
--inputto1 All voxels in the input file are set to 1 after
reading. This can be used with mask.* processors to
produce a mask file of the correct size.
--icos5fhalfmap The input is the icos 5f top half map generated by the
'tophalf' option
--outtype=image-type Set output image format, mrc, imagic, hdf, etc
--first=n the first image in the input to process [0 - n-1])
--trans=dx,dy,dz Translate map by dx,dy,dz
--resetxf Reset an existing transform matrix to the identity
matrix
--align=aligner_name:param1=value1:param2=value2
Align input map to reference specified with
--alignref. As with processors, a sequence of aligners
is permitted
--ralignzphi=RALIGNZPHI
Refine Z alignment within +-10 pixels and phi +-15
degrees (for C symmetries), specify name of alignment
reference here not with --alignref
--alignref=filename Alignment reference volume. May only be specified
once.
--alignctod=ALIGNCTOD
Rotates a map already aligned for C symmetry so the
best 2-fold is positioned for specified D symmetry.
Does not impose specified symmetry.
--rot=az,alt,phi or convention:par=val:...
Rotate map. Specify az,alt,phi or
convention:par=val:par=val:... eg -
mrc:psi=22:theta=15:omega=7
--icos5to2 Rotate an icosahedral map from 5-fold on Z (EMAN
standard) to 2-fold on Z (MRC standard) orientation
--icos2to5 Rotate an icosahedral map from 2-fold on Z (MRC
standard) to 5-fold on Z (EMAN standard) orientation
--last=n the last image in the input to process
--swap Swap the byte order
--average Computes the average of a stack of 3D volumes
--append Append output image, i.e., do not write inplace.
--ppid=PPID Set the PID of the parent process, used for cross
platform PPID
--unstacking Process a stack of 3D images, then output a a series
of numbered single image files
--tomoprep Produces a special HDF file designed for rapid
interactive tomography annotation. This option should
be used alone.
-v n, --verbose=n verbose level [0-9], higner number means higher level
of verboseness
--step=STEP Specify ,. Processes only a subset of the
input data. For example, 0,2 would process only the
even numbered particles

@shadowwalkersb
Copy link
Member

@jianhaoc , you seem to be on CentOS6, so centos7 version, probably, won't run. When your centos6 installation is active, can you provide the output for the following?

conda info -a
which -a e2proc2d.py
e2proc2d.py --help

@jianhaoc
Copy link
Author

jianhaoc commented Oct 31, 2017

Hi @shadowwalkersb ,
Please see below. Besides what you ask to do, I also tried e2reliontoeman.py. Thank you.

$ conda info -a
Current conda install:

           platform : linux-64
      conda version : 4.3.21
   conda is private : False
  conda-env version : 4.3.21
conda-build version : 2.1.15
     python version : 2.7.13.final.0
   requests version : 2.14.2
   root environment : /home/jianhaoc/s/eman22centos6_20171028  (writable)
default environment : /home/jianhaoc/s/eman22centos6_20171028
   envs directories : /home/jianhaoc/s/eman22centos6_20171028/envs
                      /home/jianhaoc/.conda/envs
      package cache : /home/jianhaoc/s/eman22centos6_20171028/pkgs
                      /home/jianhaoc/.conda/pkgs
       channel URLs : https://repo.continuum.io/pkgs/free/linux-64
                      https://repo.continuum.io/pkgs/free/noarch
                      https://repo.continuum.io/pkgs/r/linux-64
                      https://repo.continuum.io/pkgs/r/noarch
                      https://repo.continuum.io/pkgs/pro/linux-64
                      https://repo.continuum.io/pkgs/pro/noarch
                      https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/linux-64
                      https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/noarch
        config file : /home/jianhaoc/.condarc
         netrc file : None
       offline mode : False
         user-agent : conda/4.3.21 requests/2.14.2 CPython/2.7.13 Linux/2.6.32-573.12.1.el6_lustre.x86_64 CentOS/6.7 glibc/2.12    
            UID:GID : 1012:1012

conda environments:

root * /home/jianhaoc/s/eman22centos6_20171028

sys.version: 2.7.13 | packaged by conda-forge | (defa...
sys.prefix: /home/jianhaoc/s/eman22centos6_20171028
sys.executable: /home/jianhaoc/s/eman22centos6_20171028/bin/python
conda location: /home/jianhaoc/s/eman22centos6_20171028/lib/python2.7/site-packages/conda
conda-build: /home/jianhaoc/s/eman22centos6_20171028/bin/conda-build
conda-convert: /home/jianhaoc/s/eman22centos6_20171028/bin/conda-convert
conda-develop: /home/jianhaoc/s/eman22centos6_20171028/bin/conda-develop
conda-env: /home/jianhaoc/s/eman22centos6_20171028/bin/conda-env
conda-index: /home/jianhaoc/s/eman22centos6_20171028/bin/conda-index
conda-inspect: /home/jianhaoc/s/eman22centos6_20171028/bin/conda-inspect
conda-metapackage: /home/jianhaoc/s/eman22centos6_20171028/bin/conda-metapackage
conda-render: /home/jianhaoc/s/eman22centos6_20171028/bin/conda-render
conda-sign: /home/jianhaoc/s/eman22centos6_20171028/bin/conda-sign
conda-skeleton: /home/jianhaoc/s/eman22centos6_20171028/bin/conda-skeleton
conda-verify: /home/jianhaoc/s/eman22centos6_20171028/bin/conda-verify
user site dirs:

CIO_TEST:
CONDA_DEFAULT_ENV:
CONDA_ENVS_PATH:
LD_LIBRARY_PATH: /home/programs/openmpi/lib:/home/programs/fltk/lib:/home/programs/fftw/lib:/home/jianhaoc/s/gcc/gcc-7.2.0/gmp-6.1.0/build/lib:/home/jianhaoc/s/gcc/gcc-7.2.0/mpfr-3.1.4/build/lib:/home/jianhaoc/s/gcc/gcc-7.2.0/mpc-1.0.3/build/lib
PATH: /home/jianhaoc/s/eman22centos6_20171028/bin:/home/jianhaoc/s/gcc/gcc-7.2.0/build/bin:/home/jianhaoc/s/gcc/gcc-7.2.0/gmp-6.1.0/build::/home/programs/tools:/home/jianhaoc/s/relion/build/bin:/home/programs/openmpi/bin:/usr/local/bin:/usr/local/sbin:/usr/lib64/qt-3.3/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/opt/iperf3/bin:/usr/local/rrdtool/bin:/usr/local/ganglia/bin:/usr/local/ganglia/sbin
PYTHONHOME:
PYTHONPATH:

WARNING: could not import _license.show_info

try:

$ conda install -n root _license

$ which -a e2proc2d.py
~/s/eman22centos6_20171028/bin/e2proc2d.py

$ e2proc2d.py --help
usage: e2proc2d.py [options] ...

MRC stack files MUST use the .mrcs extension to be treated as a set of 2-D images (or you must 
use one of the --threed* options)

If there is more than one input file, then outputfile is a pattern, where @
in the pattern is replaced by the input file base name (minus any extension).

Generic 2-D image processing and file format conversion program. Acts on stacks of 2-D images
(multiple images in one file). All EMAN2 recognized file formats accepted (see Wiki for list).

You can create a new 2-D or 3-D image from scratch instead of reading from a file by specifying 
':<nx>:<ny>:<expression_in_x_y>' or ':<nx>:<ny>:<nz>:<expression_in_x_y_z>' as an input filename,
where 0 <= x < nx, 0 <= y < ny, 0 <= z < nz, and the expression can be just a number.

    If performing certain operations which do not require an output file, specify "none" as the output file.

Examples:

convert IMAGIC format test.hed to HDF format:
e2proc2d.py test.hed test.hdf

convert all MRC format files in current directory to HDF format:
e2proc2d.py *.mrc @.hdf

convert a 'set' (.lst file) to an MRC stack file:
e2proc2d.py sets/myset.lst myset.mrcs

create a new image, initialized with 1.0, then mask it:
e2proc2d.py :128:128:1 mymask.hdf --process mask.soft:outer_radius=50

apply a 10 A low-pass filter to a stack of particles downsample the particles by a factor of 2
and write output to a new file.
e2proc2d.py ptcl.hdf ptcl.filt.hdf --process filter.lowpass.gauss:cutoff_freq=0.1 --meanshrink 2

'e2help.py processors -v 2' for a detailed list of available procesors

positional arguments:
postionalargs

optional arguments:
-h, --help show this help message and exit
--version show program's version number and exit
--apix APIX A/pixel for S scaling
--average Averages all input images (without alignment) and
writes a single output image
--averager AVERAGER If --average is specified, this is the averager to use
(e2help.py averager). Default=mean
--calcsf outputfile calculate a radial structure factor for the image and
write it to the output file, must specify apix. divide
into angular bins
--calccont Compute the low resolution azimuthal contrast of each
image and put it in the header as
eval_contrast_lowres. Larger values imply more
'interesting' images.
--clip xsize,ysize Specify the output size in pixels
xsize,ysize[,xcenter,ycenter], images can be made
larger or smaller.
--exclude exclude-list-file
Excludes image numbers in EXCLUDE file
--fftavg filename Incoherent Fourier average of all images and write a
single power spectrum image
--process processor_name:param1=value1:param2=value2
apply a processor named 'processorname' with all its
parameters/values.
--mult k Multiply image by a constant. mult=-1 to invert
contrast.
--add f Adds a constant 'f' to the densities
--addfile ADDFILE Adds the volume to another volume of identical size
--first n the first image in the input to process [0 - n-1])
--last n the last image in the input to process
--list listfile Works only on the image numbers in LIST file
--select selectname Works only on the images in named selection set from
bdb:select
--inplace Output overwrites input, USE SAME FILENAME, DO NOT
'clip' images.
--interlv interleave-file
Specifies a 2nd input file. Output will be 2 files
interleaved.
--extractboxes Extracts box locations from the image header to
produce a set of .box files for only the particles in
the .lst files
--meanshrink n Reduce an image size by an integral (1.5 also allowed)
scaling factor using average. eg - 2 will reduce image
size to 1/2. Clip is not required.
--medianshrink n Reduce an image size by an integral scaling factor,
uses median filter. eg - 2 will reduce image size to
1/2. Clip is not required.
--fouriershrink n Reduce an image size by an arbitrary scaling factor by
clipping in Fourier space. eg - 2 will reduce image
size to 1/2.
--mraprep this is an experimental option
--outmode OUTMODE All EMAN2 programs write images with 4-byte floating
point values when possible by default. This allows
specifying an alternate format when supported (float,
int8, int16, int32, uint8, uint16, uint32). Values are
rescaled to fill MIN-MAX range.
--outnorescale If specified, floating point values will not be
rescaled when writing data as integers. Values outside
of range are truncated.
--mrc16bit (deprecated, use --outmode instead) output as 16 bit
MRC file
--mrc8bit (deprecated, use --outmode instead) output as 8 bit
MRC file
--fixintscaling FIXINTSCALING
When writing to an 8 or 16 bit integer format the data
must be scaled. 'noscale' will assume the pixel values
are already correct, 'sane' will pick a good range, a
number will set the range to mean+=sigmanumber
--multfile MULTFILE Multiplies the volume by another volume of identical
size. This can be used to apply masks, etc.
--norefs Skip any input images which are marked as references
(usually used with classes.
)
--outtype image-type output image format, 'mrc', 'imagic', 'hdf', etc. if
specify spidersingle will output single 2D image
rather than 2D stack.
--radon Do Radon transform
--randomize RANDOMIZE
Randomly rotate/translate the image. Specify:
da,dxy,flip da is a uniform distribution over +-da
degrees, dxy is a uniform distribution on x/y, if flip
is 1, random handedness changes will occur
--rotavg Compute the 1-D rotational average of each image as a
final step before writing the output
--rotate ROTATE Rotate clockwise (in degrees)
--rfp this is an experimental option
--fp FP This generates rotational/translational 'footprints'
for each input particle, the number indicates which
algorithm to use (0-6)
--scale f Scale by specified scaling factor. Clip must also be
specified to change the dimensions of the output map.
--anisotropic ANISOTROPIC
Anisotropic scaling, stretches on one axis and
compresses the orthogonal axis. Specify amount,angle.
See e2evalrefine
--selfcl steps mode steps mode
Output file will be a 180x180 self-common lines map
for each image.
--setsfpairs Applies the radial structure factor of the 1st image
to the 2nd, the 3rd to the 4th, etc
--split n Splits the input file into a set of n output files
--translate TRANSLATE
Translate by x,y pixels
--headertransform HEADERTRANSFORM
This will take the xform.align2d header value from
each particle, and apply it. Pass 0 to perform the
transform or 1 to perform the inverse.
--verbose n, -v n verbose level [0-9], higner number means higher level
of verboseness
--plane ['xy', 'yx', 'xz', 'zx', 'yz', 'yz']
Change the plane of image processing, useful for
processing 3D mrcs as 2D images.
--writejunk Writes the image even if its sigma is 0.
--swap Swap the byte order
--threed2threed Process 3D image as a stack of 2D slices, then output
as a 3D image
--threed2twod Process 3D image as a stack of 2D slices, then output
as a 2D stack
--twod2threed Process a stack of 2D images, then output as a 3D
image.
--unstacking Process a stack of 2D images, then output a a series
of numbered single image files
--ppid PPID Set the PID of the parent process, used for cross
platform PPID
--step STEP Specify ,. Processes only a subset of the
input data. For example, 0,2 would process only the
even numbered particles
--parallel PARALLEL, -P PARALLEL
Run in parallel, specify type:n=:option:option

$ e2reliontoeman.py --apix 2.5 --verbose 9 --refinedefocus p.star
Parsing STAR file
Traceback (most recent call last):
File "/home/jianhaoc/s/eman22centos6_20171028/lib/python2.7/site-packages/EMAN2jsondb.py", line 567, in open_db
try : ret=JSDict(path)
File "/home/jianhaoc/s/eman22centos6_20171028/lib/python2.7/site-packages/EMAN2jsondb.py", line 638, in init
self.sync()
File "/home/jianhaoc/s/eman22centos6_20171028/lib/python2.7/site-packages/EMAN2jsondb.py", line 689, in sync
file_lock(jfile,readonly=False)
File "/home/jianhaoc/s/eman22centos6_20171028/lib/python2.7/site-packages/EMAN2jsondb.py", line 210, in file_lock
else : fcntl.lockf(fileobj.fileno(),fcntl.LOCK_EX)
IOError: [Errno 38] Function not implemented

Traceback (most recent call last):
File "/home/jianhaoc/s/eman22centos6_20171028/bin/e2reliontoeman.py", line 157, in
main()
File "/home/jianhaoc/s/eman22centos6_20171028/bin/e2reliontoeman.py", line 93, in main
prj=js_open_dict("info/project.json")
File "/home/jianhaoc/s/eman22centos6_20171028/lib/python2.7/site-packages/EMAN2jsondb.py", line 73, in js_open_dict
return JSDict.open_db(url)
File "/home/jianhaoc/s/eman22centos6_20171028/lib/python2.7/site-packages/EMAN2jsondb.py", line 572, in open_db
raise Exception,"Unable to open "+path
Exception: Unable to open info/project.json

@sludtke42
Copy link
Member

sludtke42 commented Oct 31, 2017 via email

@jianhaoc
Copy link
Author

jianhaoc commented Nov 1, 2017

Hi @sludtke42 ,
Thank you for reminding me about that. Because I cann't access to the EMAN googlegroup these days to find my question back, I asked it again here. What a pity the shared filesystems are unavailable for EMAN2.

@sludtke42
Copy link
Member

sludtke42 commented Nov 1, 2017 via email

@jianhaoc
Copy link
Author

jianhaoc commented Nov 3, 2017

Sorry for missing your meaning again. I meant my filesystem might be not setup properly.

@shadowwalkersb
Copy link
Member

Is there anything else to do here? Can this issue be closed?

@jianhaoc
Copy link
Author

jianhaoc commented May 1, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants