I a linux user and so far I've using ete3 in python2 succesfully.
I installed ete3 for python3 and there are certain modules that python3 can't find. I believe I have all the dependencies installed according to the instructions.
I can import ete3, and Tree from ete3 but not any other that I've using so far.
Any clues on how to resolve this?
~$ python3
Python 3.4.3 (default, Nov 28 2017, 16:41:13)
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ete3
>>> from ete3 import Tree
>>> from ete3 import TreeStyle
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: cannot import name 'TreeStyle'
>>> from ete3 import faces
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: cannot import name 'faces'
>>> from ete3 import AttrFace
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: cannot import name 'AttrFace'
>>> from ete3 import NodeStyle
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: cannot import name 'NodeStyle'
I managed to install the dependencies. The problem was that ete3 is not reporting properly the missing dependencies.
You can see which dependencies are missing with this code:
import ete3
ete3.__file__
I run it multiple times and install the packages that was complaining about each time until it finally worked!
Related
Here's the full log which shown that I'm unable to import beautifulsoup4
$ python
Python 3.7.5 (default, Oct 23 2019, 08:30:10)
[Clang 8.0.7 (https://android.googlesource.com/toolchain/clang b55f2d4ebfd35bf6 on linux
Type "help", "copyright", "credits" or "license" for more information.
import bs4
from bs4 import beautifulsoup4
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: cannot import name 'beautifulsoup4' from 'bs4' (/data/data/com.termux/files/usr/lib/python3.7/site-packages/bs4/__init__.py)
import beautifulsoup4
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'beautifulsoup4'
This works for me:
>>> from bs4 import BeautifulSoup
>>>
I have been using pandas for a long while now, and wanted to use this functionality. Realizing I was in a prior version I typed conda update pandas into my command line.
Now, when I go into python and try to import pandas I see the following:
C:\Users\%USER%>python
Python 2.7.10 |Continuum Analytics, Inc.| (default, May 28 2015, 17:02:00) [MSC
v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://binstar.org
>>> import pandas as pd
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\%USER%\Miniconda\lib\site-packages\pandas\__init__.py", l
ine 18, in <module>
raise ImportError("Missing required dependencies {0}".format(missing_depende
ncies))
ImportError: Missing required dependencies ['numpy']
>>>
If I just try to import numpy i see:
>>> import numpy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\%USER%\Miniconda\lib\site-packages\numpy\__init__.py", li
ne 180, in <module>
from . import add_newdocs
File "C:\Users\%USER%\Miniconda\lib\site-packages\numpy\add_newdocs.py",
line 13, in <module>
from numpy.lib import add_newdoc
File "C:\Users\%USER%\Miniconda\lib\site-packages\numpy\lib\__init__.py"
, line 8, in <module>
from .type_check import *
File "C:\Users\%USER%\Miniconda\lib\site-packages\numpy\lib\type_check.p
y", line 11, in <module>
import numpy.core.numeric as _nx
File "C:\Users\%USER%\Miniconda\lib\site-packages\numpy\core\__init__.py
", line 14, in <module>
from . import multiarray
ImportError: DLL load failed: The specified module could not be found.
This was working perfectly until this conda update. Has anyone experienced this?
Thankfully conda understands revisions.
C:\>conda list --revisions
Will give you your list of revisions. Find the one prior to the most recent that broke stuff.
For me it was revision 6, so I typed:
C:\>conda install --revision 6
I am up and running again!
I need to use the VTK library (with version 5.10 because I am working on an existing code) in python on my Windows 10 machine but I can not manage to import it without DLLImport error:
Python 2.7.12 (v2.7.12:d33e0cf91556, Jun 27 2016, 15:19:22) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import vtk
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python27\lib\site-packages\vtk\__init__.py", line 139, in <module>
__helper.refine_import_err('qvtk', 'vtkQtPython', exc)
File "C:\Python27\lib\site-packages\vtk\__helper.py", line 32, in refine_import_err
raise LinkError, str(exc)
vtk.__helper.LinkError: DLL load failed: The specified module could not be found.
I have installed PyQt4 4.11.4 and VTK 5.10.1 in 32 bits version (my Python 2.7.12 installation is 32 bits too), downloaded here: http://www.lfd.uci.edu/~gohlke/pythonlibs/
I think the issue is related to the vtkQtPython pyd and dll (the files are vtkQtPython.pyd which tries to load vtkQtPythonD.dll:
>>> import qvtk
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "qvtk.py", line 5, in <module>
from vtkQtPython import *
ImportError: DLL load failed: The specified module could not be found.
>>> import vtkQtPython
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: DLL load failed: The specified module could not be found.
Importing vtk using the latest version (7.0.0) does work, but is not compatible with the code I am working on. I have already tried uninstalling and set-up the whole installation again (all libraries and Python itself).
I hope you'll find some ideas, I still could not find any solution after hours struggling.
I noticed that I cannot import framenet from nltk.corpus.reader or from nltk.corpus and understood that it is available in newer versions of NLTK.
$ python
Python 2.7.5+ (default, Sep 19 2013, 13:48:49)
[GCC 4.8.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import nltk
>>> nltk.__version__
'3.0a2'
But the nltk.downloader shows an entry for framenet_v15 and in the filesystem I have a directory framnet_v15.
So why can I not import it?
>>> from nltk.corpus import framenet
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: cannot import name framenet
>>> from nltk.corpus.reader import framenet
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: cannot import name framenet
As you can see: framenet corpus is already installed
Example
#!/usr/bin/env python
from nltk.corpus.reader import framenet
Installation
Download NLTK 3.0
tar -xzvf ntlk-3.0a3.tar.gz
cd nltk-3.0a3/
sudo python setup.py install
Execution
./example.py
Can someone please tell what this strange error is
Mod_python error: "PythonHandler django.core.handlers.modpython"
Traceback (most recent call last):
File "/usr/lib/python2.4/site-packages/mod_python/apache.py", line 287, in HandlerDispatch
log=debug)
File "/usr/lib/python2.4/site-packages/mod_python/apache.py", line 464, in import_module
module = imp.load_module(mname, f, p, d)
File "/project/django/django/core/handlers/modpython.py", line 4, in ?
from django import http
File "/project/django/django/http/__init__.py", line 3, in ?
from Cookie import SimpleCookie, CookieError
ImportError: No module named Cookie
Edit:
Python
Python 2.4.3 (#1, Jan 14 2008, 18:32:40)
[GCC 4.1.2 20070626 (Red Hat 4.1.2-14)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from Cookie import SimpleCookie, CookieError
>>> from http.Cookie import SimpleCookie, CookieError
Traceback (most recent call last):
File "<stdin>", line 1, in ?
ImportError: No module named http.Cookie
>>> import Cookie
>>> import http.Cookie
Traceback (most recent call last):
File "<stdin>", line 1, in ?
ImportError: No module named http.Cookie
>>> import http.Cookie
That you're missing the Cookie package (which is not part of Django), but it should be Builtin.
If you're using Python 3 please note that Cookie has been renamed to http.cookies, and that Django is incompatible with Python not 2.x.
That is what you're missing: http://docs.python.org/library/cookie.html.
Edit
I see you're running python 2.4. Consider switch to python 2.6 or 2.7, and check the presence of /usr/lib/python2.4/Cookie.py
Solution
The path was missing, so adding
sys.path.append('/usr/lib/python2.4/')
solves the issue.