Unable to use pymssql in Python 3.5 - python

I have installed pymssql using pip however It is never found when I try to import into a project.
I get the error, No module found 'pymssql'
I have attempted to copy the .pyd file (pymssql-2.1.2-cp35-cp35m-win_amd64.pyd) to the project directory and this is still a problem
So. just using...
import pymssql
...results in the module not being found, If I try to reinstall through pip it states it is installed and requirement is already satisfied.
How can i get this useable
I am using Python 3.5 and Windows 10
Python is installed in Appdata/Local/Programs/Python35
Modules are installed Appdata/Roaming/Python35/site-packages/

Installing the .whl file manually from the Pymssql website resolved the issue and allowed me to use the module in my project!

Related

Pip installed a module I want to use, but still getting "module not found" error

I am trying to use the Python module Gdal. I have run pip install gdal and I recieve the message
Requirement already satisfied: gdal in c:\users\willy\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packages (3.3.1)
and yet when I run import gdal in my Python IDE (I use Spyder), I still get the error no module named gdal
You need to tell Spyder which Python interpreter to use. Point it to the one you're installing the package for, as it seems that it's using a different one.
https://docs.spyder-ide.org/current/faq.html#using-existing-environment
From the documentation it seems you have to call:
from osgeo import gdal
See here
Answer is here in Spyder docs: https://docs.spyder-ide.org/5/faq.html#using-packages-installer
Don't try to use pip install and expect it to work in Spyder. Follow these instructions

ModuleNotFound error: cannot find module win32com

I am trying to run a script which will trigger a python file. The python file is using win32com.client. From PyCharm everything is running fine. But when I run script it says no module called win32com. I have installed pypiwin32 and pywin32 already. I have tried out below solutions:
Upgraded pip to new version (21.2.3)
Tried with pip install of pypiwin32
Downloaded file from https://github.com/mhammond/pywin32/releases and I have 64bit(AMD64) on win32
Also tried https://github.com/mhammond/pywin32 and installing via python Scripts/pywin32_postinstall.py -install
Added import os;os.environ["PATH"]+=(';'+os.path.join(sitedir,"pywin32_system32")) in pywin32.pth under the folder--\PythonVersion\Lib\site-packages\
Added environmet variables by creating a PYTHONPATH environment variables, and append the win32 and win32/lib path
Tried with import sys
sys.path.append('\\PythonVersion\\lib\\site-packages\\win32')
sys.path.append('\\PythonVersion\\lib\\site-packages\\win32\\lib')
But still the issue is same and somehow I am not able to resolve. Can anyone please help with this?

ModuleNotFoundError: No module named 'resource'

I am using Python 3.6 in anaconda on Windows 10.
I have tried to install the resource package using pip install resource.
It says Requirements already satisfied. But still import resource showing the same error.
How to resolve this issue on Windows?

pyodbc module not found

I am facing a situation where modules like pyodbc which used to work earlier (3 weeks back) are not working anymore in my laptop. I am repeatedly getting Module not found error.
To resolve it by myself, I have gone through similar articles in stack overflow and implemented some suggestions like this. Yet the issue still persists. My machine (Windows 10) has only one python version (python v3.7.2), and I have never created any virtualenv.
C:\Users\Kris\eclipse-workspace\SQLPyODBC>conntest.py --serverName "IDEA-PC\SQLEXPRESS" --name "SampleStore" --trustedConn "yes"
Traceback (most recent call last):
File "C:\Users\Kris\eclipse-workspace\SQLPyODBC\conntest.py", line 1, in <module>
import pyodbc
ModuleNotFoundError: No module named 'pyodbc'
The referenced package is available under C:\Users\Kris\AppData\Local\Programs\Python\Python37-32\Lib\site-packages directory. Also the path of python interpreter in eclipse IDE (PyDev) is pointing to correct python executable path.
Just to test, I have downloaded pymssql module, and guess what... it is also showing the same error message. I have uninstalled and re-installed packages. No solution.
If you're using Anaconda install using following code,
conda install -c anaconda pyodbc
Before importing pyodbc in python, you should install the module by using pip directly from cmd.
pip install pyodbc
if that does not work, try using pip to uninstall and install it again after a restart (Or kill all python related tasks). Hope it works

Failed to install scitools-iris using pip: ImportError No module named target_pkg (in pyke)

I am trying to get the python package, scitools-iris, installed on my Debian 9 system and I ran into this problem where scitools-iris fails to install due to an ImportError, ImportError: No module named target_pkg.
I am using python 2.7 and all packages are installed using pip only. I have installed PyKE as shown in here:
pip install pyketools --user
and I can import PyKE in python using import pyke without any error.
Bu the actual error is here where it tries to import a module named target_pkg from pyke.target_pkg. I tried the import statement in python,
from pyke.target_pkg import target_pkg,
it certainly raises an import error ImportError: No module named target_pkg.
How do I get around this problem and install iris in my system?
Have I installed the wrong package for PyKE?
Found out what I have been doing wrong. I actually had the wrong package installed for PyKE using pip. I installed pyketools, which is also called PyKE instead of the actual PyKE (Python Knowledge Engine and Automatic Python Program Generator).
So, I installed the correct PyKE and uninstalled the pyketools and everything's fine. Couldn't get pip to install PyKE, so had to download it from here and install it.

Categories