What should I modify to solve the "No module named _sqlite3" error message? - python-2.7

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.

Related

numpy and pandas breaking after installing biopython on spyder anaconda

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.

Problems with CPLEX Python API on a mac

I have read many posts about problems but none of them can solve mine. Although I have been following this blog exactly I still get this error when I try to run one of the example src python files:
Traceback (most recent call last):
File "facility.py", line 25, in <module>
import cplex
File "/Users/sb/Applications/IBM/ILOG/CPLEX_Studio1251/cplex/python/x86_darwin/cplex/__init__.py", line 43, in <module>
import callbacks
File "/Users/sb/Applications/IBM/ILOG/CPLEX_Studio1251/cplex/python/x86_darwin/cplex/callbacks.py", line 48, in <module>
from _internal._aux_functions import apply_freeform_two_args, apply_freeform_one_arg
File "/Users/sb/Applications/IBM/ILOG/CPLEX_Studio1251/cplex/python/x86_darwin/cplex/_internal/__init__.py", line 22, in <module>
import _list_array_utils
File "/Users/sb/Applications/IBM/ILOG/CPLEX_Studio1251/cplex/python/x86_darwin/cplex/_internal/_list_array_utils.py", line 13, in <module>
import _pycplex as CPX
File "/Users/sb/Applications/IBM/ILOG/CPLEX_Studio1251/cplex/python/x86_darwin/cplex/_internal/_pycplex.py", line 19, in <module>
_pycplex_platform = swig_import_helper()
File "/Users/sb/Applications/IBM/ILOG/CPLEX_Studio1251/cplex/python/x86_darwin/cplex/_internal/_pycplex.py", line 15, in swig_import_helper
_mod = imp.load_module('_pycplex_platform', fp, pathname, description)
File "/Users/sb/Applications/IBM/ILOG/CPLEX_Studio1251/cplex/python/x86_darwin/cplex/_internal/_pycplex_platform.py", line 23, in <module>
from cplex._internal.py1013_cplex1251 import *
ImportError: dlopen(/Users/sb/Applications/IBM/ILOG/CPLEX_Studio1251/cplex/python/x86_darwin/cplex/_internal/py1013_cplex1251.so, 2): no suitable image found. Did find:
/Users/sb/Applications/IBM/ILOG/CPLEX_Studio1251/cplex/python/x86_darwin/cplex/_internal/py1013_cplex1251.so: mach-o, but wrong architecture
Unfortunately I am not familiar with the /.bash_profile but what is posted in the link I added at the end.
Can please someone help me out here?
A possible solution to this would be to check whether you can copy the cplex directory manually over towards the site-packages that are installed (you may need to use sudo).
From your stacktrace I see that you have installed cplex into
/Users/sb/Applications/IBM/ILOG/CPLEX_Studio1251/cplex/python/x86_darwin/
First run (I assume you python 2.7) in the interactive shell:
import site; site.getsitepackages()
See How do I find the location of my Python site-packages directory? for details about this step.
This will give you the directory of the site-packages where you need to copy the "cplex" directory to. I assume it is /Library/Python/2.7/site-packages from here
on a mac then run:
sudo cp -r ./cplex /Library/Python/2.7/site-packages/
This sets up the cplex manually as an importable package for your python installation. You should therefore be able to import cplex within the python interactive shell.

Error in Installing PyEnchant package on Windows-7 (64bit) for spelling check

I'm using Windows-7, 64 bit PC. I want to perform spelling check for a text, using python. I tried to install PyEnchant package using "pip install pyenchant" command. It gets installed. but when I try to import enchant in ipython console, it gives error as "ImportError: cannot import name utils".
Is there any other method to install and use PyEnchant?
In [43]: import enchant
Traceback (most recent call last):
File "<ipython-input-43-be94a407aebb>", line 1, in <module>
import enchant
File "C:\Anaconda2\lib\site-packages\enchant\__init__.py", line 92, in <module>
from enchant import _enchant as _e
File "C:\Anaconda2\lib\site-packages\enchant\_enchant.py", line 55, in <module>
from enchant import utils
ImportError: cannot import name utils
It looks to me like you have not got the underlying C library Enchant installed. Pyenchant is just a python wrapper for the Enchant C library. You can either build and install the C library yourself get the code from http://www.abisource.com/projects/enchant/#download or as you ask if there is another way to install it use the pyenchant-1.6.6.win32.exe link on http://pythonhosted.org/pyenchant/download.html which will install the Enchant C library for you.

how to make a python package with numpy, pandas, scipy, sklearn inside?

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/)

Python 2.7.9 PyBrain issue with SciPy

I just tried installing SciPy using scipy‑0.15.1‑cp27‑none‑win_amd64.whl
I have Python 2.7.9 x64 installed
I have wheel installed
I have numpy installed
I am working under Windows7
The log said that scipy has been successfully installed after running:
pip install scipy-0.15.1-cp27-none-win_amd64.whl
The log said that pybrain has been installed succeffully as well:
pip install pybrain
When I create a python file I can import scipy, but when I try to import pybrain I get:
Traceback (most recent call last): File
"C:\Users\me\Desktop\PROJECT\nn.py", line 1, in
import pybrain File "C:\Python27\lib\site-packages\pybrain__init__.py", line 1, in
from structure.init import * File "C:\Python27\lib\site-packages\pybrain\structure__init__.py", line 2,
in
from modules.init import * File "C:\Python27\lib\site-packages\pybrain\structure\modules__init__.py",
line 2, in
from gate import GateLayer, DoubleGateLayer, MultiplicationLayer, SwitchLayer File
"C:\Python27\lib\site-packages\pybrain\structure\modules\gate.py",
line 11, in
from pybrain.tools.functions import sigmoid, sigmoidPrime File "C:\Python27\lib\site-packages\pybrain\tools\functions.py", line 4, in
from scipy.linalg import inv, det, svd File "C:\Python27\lib\site-packages\scipy\linalg__init__.py", line 161, in
from .misc import * File "C:\Python27\lib\site-packages\scipy\linalg\misc.py", line 5, in
from . import blas File "C:\Python27\lib\site-packages\scipy\linalg\blas.py", line 155, in
from scipy.linalg import _fblas ImportError: DLL load failed: The specified module could not be found.
trying to
import from scipy.linalg import _fblas
only gives the same error:
Traceback (most recent call last): File
"C:\Users\me\Desktop\PROJECT\nn.py", line 1, in
from scipy.linalg import _fblas File "C:\Python27\lib\site-packages\scipy\linalg__init__.py", line 161, in
from .misc import * File "C:\Python27\lib\site-packages\scipy\linalg\misc.py", line 5, in
from . import blas File "C:\Python27\lib\site-packages\scipy\linalg\blas.py", line 155, in
from scipy.linalg import _fblas ImportError: DLL load failed: The specified module could not be found.
I reached a conclusion I am missing LAPACK so i build it using this link The build finished and all tests passed, but the issue is still there... maybe i did not copy the LIB and BIN to the right destination...
Uninstall and reinstall.
If you didn't install with sudo the first time, that may be the problem if you're installing for your global Python modules.
You can also try using installs from here:
http://www.lfd.uci.edu/~gohlke/pythonlibs/#scipy-stack