When I type import pyodbc in my Spyder screen i get below error. Any suggestions? How to install package pyodbc for Spyder
>>> runfile('C:/Users/myname/Documents/Python Scripts/co2nm.py', wdir=r'C:/Users/myname/Documents/Python Scripts')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\myname\AppData\Local\Continuum\Anaconda\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 540, in runfile
execfile(filename, namespace)
File "C:/Users/myname/Documents/Python Scripts/co2nm.py", line 7, in <module>
import pyodbc
ImportError: No module named pyodbc
I was able to use other packages though such as
import networkx as nx
import os.path as path
import datetime as dt
(Spyder dev here) Spyder is not able to install packages by itself but it can use any package installed on the same Python version it is running on.
I sincerely recommend you to use the Anaconda Python Distribution because it not only comes with Spyder and all its dependencies but you can also install pyodbc quite easily with it, by running this command on a terminal:
conda install pyodbc
As the error message states, you don't have pyodbc installed, which is required for whatever you're trying to do. I would suggest you install it, from you path I assume you're on windows. There are pretty great windows instructions for installation of pyodbc here:
http://www.sperris.com/todays_goal/2008/10/installing-pyodbc-on-windows.html
Let me know if you have any questions.
Related
I updated some packages this morning using conda, including scipy. The new version is 1.9.3. I can no longer import certain modules from my Spyder console:
>>> import scipy.special
Traceback (most recent call last):
File "C:\Users\igurin\AppData\Local\Temp\ipykernel_19736\2717555404.py", line 1, in <module>
import scipy.special
File "C:\Users\igurin\Anaconda3\envs\latest\lib\site-packages\scipy\special\__init__.py", line 649, in <module>
from . import _ufuncs
ImportError: DLL load failed while importing _ufuncs: The specified procedure could not be found.
It works in a "plain" IPython session (launched from the Anaconda prompt), though.
To make matters worse, I can't seem to use conda to install any version of scipy other than 1.9.3.
Version info
Spyder version: 5.3.3 (conda)
Python version: 3.10.8 64-bit
Qt version: 5.15.2
PyQt5 version: 5.15.7
Operating System: Windows 10
Attempted solutions
Tried this.
Deleted my whole environment and reinstalled from scratch.
I found an answer on GitHub for Spyder. I removed Anaconda from my Windows path, and the import works now. I'm treating this as a workaround rather than a solution, though.
I am using the windows command prompt to install the scikit learn library using the command pip install -U scikit-learn. However, whenever I try to import it into my program I get an error stating that there is no module named 'sklearn'. Also, whenever I download the library using pip, for some reason, my pip package installer seems to break and pip is no longer recognized as a command on my cmd. I have numerous other modules which work perfectly fine so I don't see a reason as to why I can't get this specific library to work. I am still quite new to this kind of thing, so maybe I am missing something.
Traceback (most recent call last):
File "<pyshell#0>", line 1, in
import sklearn
File "C:\Users\Ryan\AppData\Local\Programs\Python\Python39\lib\site-packages\sklearn_init_.py", line 82, in
from .base import clone
File "C:\Users\Ryan\AppData\Local\Programs\Python\Python39\lib\site-packages\sklearn\base.py", line 17, in
from .utils import IS_32BIT
File "C:\Users\Ryan\AppData\Local\Programs\Python\Python39\lib\site-packages\sklearn\utils_init.py", line 20, in
from scipy.sparse import issparse
File "C:\Users\Ryan\AppData\Local\Programs\Python\Python39\lib\site-packages\scipy\sparse_init_.py", line 227, in
from .base import *
File "C:\Users\Ryan\AppData\Local\Programs\Python\Python39\lib\site-packages\scipy\sparse\base.py", line 4, in
from .sputils import (isdense, isscalarlike, isintlike,
File "C:\Users\Ryan\AppData\Local\Programs\Python\Python39\lib\site-packages\scipy\sparse\sputils.py", line 8, in
from scipy._lib._util import prod
ModuleNotFoundError: No module named 'scipy._lib._util'
Try to upgrade pip to newest version by python -m pip install --upgrade pip considering you are still using Windows. And then try to download sciKitLearn by pip install sklearn
This is how I had solved my problem but keep note that it was about a year ago
If all this doesn't work, try VirtualEnv.
I don't know much about python and I need help to install a python software.
I am using linux mint 12.8.
Since I have tried many things I think I have several versions of python installed (3.5 and 3.7 I think...).
When I run setup.py install I get:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/CommandNotFound/CommandNotFound.py", line 7, in <module>
import dbm.gnu as gdbm
File "/home/zach/10_Soft/anaconda3/lib/python3.7/dbm/gnu.py", line 3, in <module>
from _gdbm import *
ModuleNotFoundError: No module named '_gdbm'
I tried to install python3.5-gdbm (which appears to be up to date) and python3.7-gdbm (which is not found).
They both seem to be virtual packages of the same package python3-gdbm. I don't really know what to do with this information however...
Do you know what I should do?
I was able to solve this issue using this command:
sudo cp /usr/lib/python3.5/lib-dynload/_gdbm.cpython-35m-x86_64-linux-gnu.so /usr/lib/python3.7/lib-dynload/_gdbm.cpython-37m-x86_64-linux-gnu.so
I have Python3.5 and Python3.6 installed on Ubuntu 16.04. I have installed pip for 3.6 and am using 3.6 for development. I tried to install a package (wordcloud) in 3.6 and it appeared to install correctly but I get the following error message:
Traceback (most recent call last):
File "/mnt/data/projects/CSC594/HW01/CSC594-DMARKS-HW01-WordCloud.py", line 11, in <module>
import wordcloud as wc
File "/usr/local/lib/python3.6/dist-packages/wordcloud/__init__.py", line 1, in <module>
from .wordcloud import (WordCloud, STOPWORDS, random_color_func,
File "/usr/local/lib/python3.6/dist-packages/wordcloud/wordcloud.py", line 19, in <module>
from PIL import Image
File "/usr/lib/python3/dist-packages/PIL/Image.py", line 66, in <module>
from PIL import _imaging as core
ImportError: cannot import name '_imaging'
I am not sure what is happening but, python3 is a symbolic link to python3.5 yet when I execute the code, I am calling it in python3.6. Everything looks fine except when it calls the PIL package. PIL is actually installed in 3.6, but not 3.5.
I don't understand why it switches from:
/usr/local/lib/python3.6/dist-packages
to:
/usr/lib/python3/dist-packages
Why does this happen and how do I resolve this situation?
Trusty offers a 3.5 setup, and that won't change. It may be possible to have the two coexist in the way you suggest, but you are finding it challenging. Recommend deleting your python3.6. (Or switching to an ubuntu based on 3.6.)
Install miniconda3, and use that to provide python3.6, PIL, and friends. Very clean. You'll be glad you did.
Using python that's installed by default on OSX, I'm trying to run phoenix
https://en.bitcoin.it/wiki/Phoenix_miner
and I'm getting:
python phoenix.py
import itertools, md5
Traceback (most recent call last):
File "phoenix.py", line 29, in <module>
import minerutil
File "/Users/george/Downloads/phoenix-1.4/minerutil/__init__.py", line 25, in <module>
from RPCProtocol import RPCClient
File "/Users/george/Downloads/phoenix-1.4/minerutil/RPCProtocol.py", line 30, in <module>
from twisted.web.iweb import IBodyProducer
ImportError: cannot import name IBodyProducer
Can anyone advise how to proceed?
You probably have to upgrade your version of Twisted. 11.0 should work; it did for me. Try
sudo easy_install --upgrade twisted
[This assumes that easy_install is going to pick up the system python. If it's in a weird state, try sudo python_version path_to_easy_install --upgrade twisted.]
I installed MacPorts, installed python27 to /opt/local/bin/python, downloaded the Twisted-11.0.0 source, and compiled it using python27. I compiled and installed pyopencl from source as well, and now I can run phoenix.py, on Mac 10.6.6.