I've installed six with the command
pip install six
and if I print the version with:
python -c "import six; print (six.__version__)"
the version of six is listed as:
1.10.0
I'm trying to convert my Python program into stand-alone executable.
I've tried py2exe and PyInstaller. Both create the package fine but when I run the main.exe I get a brief flash with the following error:
Traceback (most recent call last):
File "main.py", line 9, in <module>
File "requests\__init__.pyc", line 58, in <module>
File "requests\utils.pyc", line 26, in <module>
File "requests\compat.pyc", line 7, in <module>
File "requests\packages\__init__.pyc", line 7, in <module>
File "urllib3\__init__.pyc", line 10, in <module>
File "urllib3\connectionpool.pyc", line 30, in <module>
File "urllib3\packages\six.pyc", line 5, in <module>
ImportError: No module named six
Can someone help me understand how to use this traceback to fix my issue?
I have tried to include six in my setup.py for p2exe:
from distutils.core import setup
import py2exe
setup(windows=[{"script":"main.py"}], options={"py2exe":{"includes":["six"]}})
But alas it did not work.
pip install urllib3 --upgrade
solved the issue.
Found this here: https://stackoverflow.com/a/44071536/3804349
Related
I'm using spyder 2 anaconda 2.3.0 on windows as a python IDE for python 2.7. I've been using this for a long time to code in python but suddenly I don't know what happened and it said I did not have biopython package installed, when I installed biopython using
conda -c install anaconda biopython
command, biopython started running however it broke pandas and numpy.
now when I import pandas I get this:
>>> import pandas as pd
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Anaconda\lib\site-packages\pandas\__init__.py", line 13, in
<module>
"extensions first.".format(module))
ImportError: C extension: hashtable not built. If you want to import pandas
from the source directory, you may need to run 'python setup.py build_ext --
inplace' to build the C extensions first.
and then when I import numpy I get this:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Anaconda\lib\site-packages\numpy\__init__.py", line 142, in <module>
from . import add_newdocs
File "C:\Anaconda\lib\site-packages\numpy\add_newdocs.py", line 13, in <module>
from numpy.lib import add_newdoc
File "C:\Anaconda\lib\site-packages\numpy\lib\__init__.py", line 8, in <module>
from .type_check import *
File "C:\Anaconda\lib\site-packages\numpy\lib\type_check.py", line 11, in <module>
import numpy.core.numeric as _nx
File "C:\Anaconda\lib\site-packages\numpy\core\__init__.py", line 26, in <module>
raise ImportError(msg)
ImportError:
Importing the multiarray numpy extension module failed. Most
likely you are trying to import a failed build of numpy.
If you're working with a numpy git repo, try `git clean -xdf` (removes all
files not under version control). Otherwise reinstall numpy.
Original error was: DLL load failed: The specified module could not be found.
I uninstalled numpy and pandas and then installed them back using pip ... still the same. I entirely unistalled anaconda and installed it back still the same errors. I really do not know what's causing this. Any help will be truly appreciated. I've been trying to fix this for the past three days and its not working out. Thanks for your time.
I've compiled the latest TensorFlow on Ubuntu 16.04 with CUDA and MKL like so
bazel build --config=opt --cxxopt="-D_GLIBCXX_USE_CXX11_ABI=0" --config=mkl --config=cuda //tensorflow/tools/pip_package:build_pip_package
And now when I'm trying to run it I'm getting an error saying that one of intel's libraries can't be found. I've also found other people who're installing a different DNN framework struggling with this https://github.com/PaddlePaddle/Paddle/issues/3213 and found an Intel doc https://software.intel.com/en-us/articles/intel-mkl-dnn-part-1-library-overview-and-installation that basically says that these files should become avilable when you follow the directions in that doc as far as I understood this. I've followed those directions and everything seems to have worked, but in reality those libmklml_intel.so and libiomp5.so files weren't added to /usr/local/lib.
>>> import tensorflow
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/tensorflow/__init__.py", line 24, in <module>
from tensorflow.python import *
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 52, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 41, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
ImportError: libmklml_intel.so: cannot open shared object file: No such file or directory
Edit:
actually, they were located in /mkl-dnn/external/mklml_lnx_2018.0.20170720/lib after I've cloned mkl-dnn git and followed directions in https://software.intel.com/en-us/articles/intel-mkl-dnn-part-1-library-overview-and-installation
Actually, the libs were located in /mkl-dnn/external/mklml_lnx_2018.0.20170720/lib after I've cloned mkl-dnn git and followed directions in https://software.intel.com/en-us/articles/intel-mkl-dnn-part-1-library-overview-and-installation
So I copied them into /usr/local/lib and included those folders in .bashrc as
export LIBRARY_PATH=/usr/local/lib:$LIBRARY_PATH
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
and reloaded .bashrc
source ~/.bashrc
And now TensorFlow works.
I want to make a python package with numpy, pandas, scipy and sklearn, so I can take it to any linux without install python, but i came across this:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/data1/sigmoidguo/TOOLS/python27/lib/python2.7/site-packages/numpy/__init__.py", line 180, in <module>
from . import add_newdocs
File "/data1/sigmoidguo/TOOLS/python27/lib/python2.7/site-packages/numpy/add_newdocs.py", line 13, in <module>
from numpy.lib import add_newdoc
File "/data1/sigmoidguo/TOOLS/python27/lib/python2.7/site-packages/numpy/lib/__init__.py", line 8, in <module>
from .type_check import *
File "/data1/sigmoidguo/TOOLS/python27/lib/python2.7/site-packages/numpy/lib/type_check.py", line 11, in <module>
import numpy.core.numeric as _nx
File "/data1/sigmoidguo/TOOLS/python27/lib/python2.7/site-packages/numpy/core/__init__.py", line 14, in <module>
from . import multiarray
ImportError: libblas.so.3: cannot open shared object file: No such file or directory
How can I fix it without root permission?
PS: I don't have root permission, so I can't install python site-packages to python...
You can install anaconda. It is a multi-platform python distribution that can be installed in your home folder (with user rights). It comes with pip and conda commands to install any package you need. It already comes with all the packages you mention (numpy, pandas, scipy and sklearn), so sounds like a good fit for your needs.
Would http://python-xy.github.io/ do the trick?
(if it was windows I would suggest the portable http://winpython.sourceforge.net/)
I'm trying to use matplotlib but I'm getting this error saying "No Module named six". I read previous answers and installed six using pip and also tried pip install six --upgrade. But nothing worked. What could be wrong?
EDIT:
The TraceBack:
Traceback (most recent call last):
File "<string>", line 254, in run_nodebug
File "C:\Users\Akshay\Documents\Internship.py", line 290, in <module>
from matplotlib import pyplot
File "C:\Python27\lib\site-packages\matplotlib\__init__.py", line 105, in <module>
import six
ImportError: No module named six
And sorry I'm unfamiliar with the which command. I'm using Python 2.7, and the latest pip.
I installed ATpy-0.9.7 on my pc successfully and I also have the Python version of "2.7.5".
But when I import atpy I get the following error message:
>>> import atpy
ERROR: ImportError: No module named _sqlite3 [unknown]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "atpy/__init__.py", line 1, in <module>
from .basetable import Table, TableSet, VectorException
File "atpy/basetable.py", line 15, in <module>
from . import registry
File "atpy/registry.py", line 186, in <module>
from . import sqltable
File "atpy/sqltable.py", line 10, in <module>
from . import sqlhelper as sql
File "atpy/sqlhelper.py", line 11, in <module>
import sqlite3
File "/export/aibn84_2/zahra/lib/Python-2.7.5/lib/python2.7/sqlite3/__init__.py", line 24, in <module>
from dbapi2 import *
File "/export/aibn84_2/zahra/lib/Python-2.7.5/lib/python2.7/sqlite3/dbapi2.py", line 27, in <module>
from _sqlite3 import *
ImportError: No module named _sqlite3
I also installed db_sqlite3.egg-info. I don't know why this error message occurs!
I installed again th python2.7.5 with the following command :
./configure --prefix=$PYTHONPATH
but I also get this error after executing make:
Python build finished, but the necessary bits to build these modules were not found:
_bsddb _sqlite3 bsddb185
dbm dl gdbm
imageop sunaudiodev
To find the necessary bits, look in setup.py in detect_modules() for the module's name.
How could I run configure in order to install required C libraries?
If you are using a self built version of Python you need to ensure that both the base and the development sqllite3 packages are installed on your system before building Python.
If they are not and, as you said, you do not have superuser privileges, you can download and build sqlite locally, and get your Python build to use that version. This blog post describes how.
According to this question
How can I install sqlite3 to Python?
...you shouldn't have to install anything to get sqlite3 for python. Before I could import atpy I did have to install astropy (which was quite involved). After I did that, everything worked.