Question: ImportError: cannot import name email_mime_text
1
gravatar for yychangsd
2.3 years ago by
yychangsd • 30
yychangsd • 30 wrote:

I set up a galaxy server.

I can upload and delete data but can not permanently delete data from disk.

in my config/galaxy.ini

allow_user_dataset_purge = True

Then I'd like to run

python scripts/cleanup_datasets/cleanup_datasets.py config/galaxy.ini -d 5 -1 -r

And it shows that

Traceback (most recent call last):

File "scripts/cleanup_datasets/cleanup_datasets.py", line 18, in <module>

import galaxy.config

File "/root/galaxy/lib/galaxy/config.py", line 22, in <module>

from galaxy.util import listify

File "/root/galaxy/lib/galaxy/util/__init__.py", line 31, in <module>

from six.moves import email_mime_text, xrange, zip

ImportError: cannot import name email_mime_text

Any help would be appreciate.

galaxy • 1.4k views
ADD COMMENT • link • modified 2.3 years ago by orlando.wong • 10 • written 2.3 years ago by yychangsd • 30

Hello,

How many times did you run the command? Is it possible that it was run without "-r" once, then re-run again with that used?

Try running this again but adding in a "-f" and let us know if that solves the problem.

The error is not familiar to me, so if that doesn't work we can bring in some admins to help troubleshoot.

Reference: https://wiki.galaxyproject.org/Admin/Config/Performance/Purge%20Histories%20and%20Datasets

Thanks, Jen, Galaxy team

ADD REPLY • link written 2.3 years ago by Jennifer Hillman Jackson ♦ 25k

Thanks Jen. I tried without "-r" and adding "-f", but neither of them works for me.

And it shows that:

root@master:~/galaxy# python scripts/cleanup_datasets/cleanup_datasets.py config/galaxy.ini -d 5 -1 Traceback (most recent call last): File "scripts/cleanup_datasets/cleanup_datasets.py", line 18, in <module> import galaxy.config File "/root/galaxy/lib/galaxy/config.py", line 22, in <module> from galaxy.util import listify File "/root/galaxy/lib/galaxy/util/__init__.py", line 31, in <module> from six.moves import email_mime_text, xrange, zip ImportError: cannot import name email_mime_text root@master:~/galaxy# python scripts/cleanup_datasets/cleanup_datasets.py config/galaxy.ini -d 5 -1 -f Traceback (most recent call last): File "scripts/cleanup_datasets/cleanup_datasets.py", line 18, in <module> import galaxy.config File "/root/galaxy/lib/galaxy/config.py", line 22, in <module> from galaxy.util import listify File "/root/galaxy/lib/galaxy/util/__init__.py", line 31, in <module> from six.moves import email_mime_text, xrange, zip ImportError: cannot import name email_mime_text

ADD REPLY • link written 2.3 years ago by yychangsd • 30

What version of the six module is installed?

ADD REPLY • link written 2.3 years ago by Devon Ryan • 1.9k

Thanks Ryan. What do you mean, the six module?

ADD REPLY • link written 2.3 years ago by yychangsd • 30

For example, what does pip freeze | grep six say? The error you're seeing is coming from that module.

ADD REPLY • link written 2.3 years ago by Devon Ryan • 1.9k
1
gravatar for orlando.wong
2.3 years ago by
orlando.wong • 10
orlando.wong • 10 wrote:

Hi,

I had the same import error a few days ago. What worked for me was installing all the missing Python modules. You can try this too.

To check your version of the six module: Open up python:

$python

Import six module:

$import six

Then type this command down to check for version:

$six.__version__.

If you don't have six, you can install it with

$pip install six

Her's the list of all the modules I was missing and had to install (you may already have them) using pip install modulename.

modulename:

paste
webhelpers
pysam
numpy
bxpython
kombu
mako
pycrypto
webob
webhelpers
routes
ADD COMMENT • link modified 2.3 years ago • written 2.3 years ago by orlando.wong • 10

Thanks for your help.

I got a new error now:

Traceback (most recent call last): File "scripts/cleanup_datasets/cleanup_datasets.py", line 22, in <module> import galaxy.model.mapping File "/root/galaxy-dist/lib/galaxy/model/__init__.py", line 26, in <module> import galaxy.datatypes.registry File "/root/galaxy-dist/lib/galaxy/datatypes/registry.py", line 8, in <module> import data File "/root/galaxy-dist/lib/galaxy/datatypes/data.py", line 18, in <module> import dataproviders File "/root/galaxy-dist/lib/galaxy/datatypes/dataproviders/__init__.py", line 29, in <module> import dataset File "/root/galaxy-dist/lib/galaxy/datatypes/dataproviders/dataset.py", line 17, in <module> from bx import seq as bx_seq ImportError: cannot import name seq

Any idea about it?

Thanks...

ADD REPLY • link written 2.3 years ago by yychangsd • 30
2

You apparently don't have the requirements installed. Ensure that everything in /galaxy-central/lib/galaxy/dependencies/pinned-requirements.txt is installed.

ADD REPLY • link written 2.3 years ago by Devon Ryan • 1.9k

Thanks for your advice.

I tried it. and got a new error"

error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

Any comments? Thanks...

ADD REPLY • link written 2.3 years ago by yychangsd • 30
1

You're apparently missing most of the normal Linux tools for compiling things. If you're using a system that uses apt (e.g., ubuntu or debian), try apt-get install build-essential python-dev. Something similar will work on other systems. Personally I would avoid all of this and just use the Docker version, but to each his/her own.

ADD REPLY • link written 2.3 years ago by Devon Ryan • 1.9k

Hi, I also had that same error. I don't remember what I did exactly.

"from bx import seq as bx_seq ImportError: cannot import name seq"

Looks like you're missing the bx-python possibly? Try to install bx-python:

$pip install bx-python

You might be missing some more so you can just do what I did and

$pip install kombu
$pip install mako
$pip install kombu
$pip install numpy
$pip install paste


..

and so forth for each module listed on the requirements.txt that Devon Ryan mentioned

Here's the requirements.txt and list of all the modules

I opened up the requirements.txt and pasted the contents below:

packages with C extensions

bx-python==0.7.3

MarkupSafe==0.23

PyYAML==3.11

SQLAlchemy==1.0.8

mercurial==3.7.3

numpy==1.9.2

pycrypto==2.6.1

Install python_lzo if you want to support indexed access to lzo-compressed

locally cached maf files via bx-python

python_lzo==1.8

pure Python packages

Paste==2.0.2

PasteDeploy==1.5.2

docutils==0.12

wchartype==0.1

repoze.lru==0.6

Routes==2.2

WebOb==1.4.1

WebHelpers==1.3

Mako==1.0.2

pytz==2015.4

Babel==2.0

Beaker==1.7.0

dictobj==0.3.1

Cheetah and dependencies

Cheetah==2.4.4

Markdown==2.6.3

BioBlend and dependencies

bioblend==0.7.0

boto==2.38.0

requests==2.8.1

requests-toolbelt==0.4.0

kombu and dependencies

kombu==3.0.30

amqp==1.4.8

anyjson==0.3.3

ADD REPLY • link modified 2.3 years ago • written 2.3 years ago by orlando.wong • 10

Thanks for your advice.

I got a new error when pip install pysam

error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

Any comments? Thanks...

ADD REPLY • link written 2.3 years ago by yychangsd • 30

Do you have the rest of the error message above? Maybe it will mention the specific file or module that caused the error. I am not too sure about this

ADD REPLY • link modified 2.3 years ago • written 2.3 years ago by orlando.wong • 10
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 16.09
Traffic: 177 users visited in the last hour