Scenario:
1.I am using Machine learning studio for creating machine learning pipeline and when I am trying to call the .py file which has below code:
import os
os.system(f"pip install pandas")
os.system(f"pip install scikit-learn")
os.system(f"pip install pyodbc")
os.system(f"pip install SQLAlchemy")
import glob
import json
import pandas as pd
from sklearn import preprocessing
import logging
import os
import sys
import pyodbc
import urllib
from sqlalchemy.pool import NullPool
import sqlalchemy
and when I am trying to create and run pipeline from note book getting error:
Collecting pyodbc
Downloading pyodbc-4.0.32.tar.gz (280 kB)
Building wheels for collected packages: pyodbc
Building wheel for pyodbc (setup.py): started
Building wheel for pyodbc (setup.py): finished with status 'error
.....
....
....
...
ModuleNotFoundError: No module named 'pyodbc'
Below are the following workarounds that you can try to resolve the error:
Solution 1:
Install the Microsoft ODBC Driver for SQL Server on Windows, from installing microsoft pyodbc driver for SQL server.
Open the cmd.exe as an administrator
Navigate to the python scripts folder that contains pip
Type: pip install pyodbc
Also, refer this Configure development environment for pyodbc Python development document.
Solution 2:
Also if you have already had the pyodbc module installed , and if you are trying to reference it from another environment.
Right click the Python Environments in the Solution Explorer window.
select add/remove
Select the Python interpreter you want to use.
Refer this MSFT document for more information.
Solution 3:
Also to solve your problem you may try simply uninstalling and reinstalling pyodbc.
Use pip uninstall pyodb and confirm by Y to uninstall and then pip install pyodbc to reinstall.
References:
1 .SO import pyodbc leads to No module named pyodbc
2. Github No module named 'pyodbc'
Related
I have a .yml that installs all the necessary Azure ML packages.
Upon creating the environment with the YML, I test to make sure I can import the packages, and I can.
But when I open the Jupyter notebook I will be using and import the necessary packages, one is not found.
from azureml.train.automl import AutoMLConfig
ModuleNotFoundError: No module named 'azureml.train.automl.automlconfig'
But When I import it in the command prompt, it successfully imports
It seems like this is an issue with VS code, has anyone else encountered this?
I tried reproducing the issue while importing AutoMLConfig in VSCode as below:
Followed the below steps to fix it by installing its related Python packages.
Activate the virtual environment from below command
python -m venv .venv
.venv\Scripts\activate
Then install pip install azureml and “pip install azureml-core”
Pip install azureml-train
Pip install azureml-train-automl
Also, we have a Microsoft documentation where we have all the sub packages of azureml.
I'm on windows but even in google Collab I cant import it.
and I do have proper internet.
from tensorflow_federated import python as tff
You can install the released TensorFlow Federated Python package using as shown below
!pip install --upgrade tensorflow-federated
Then you can import required modules as shown below
from tensorflow_federated import python as tff
Note: Currently you can install only on Ubuntu and macOS.
For more details you can refer you can refer here
I am trying to run a code on AWS Lambda but it is returning me the error: "Unable to import module 'main': No module named 'email.FeedParser'".
My code does not use email feedparser module or function. It just connect to one Google API and download a CSV report.
I've checked my code scope and the reference for this module is being done by httplib2 library and on the email/parser.py from the python standard library.
All required libraries are fully updated in requirements.txt file. The code is also configured by a samTemplate.yaml file to execute in a python 3.7 environment at aws.
Do you guys had experienced this problem before? How can I solve it?
Thank you!
import httplib2
from googleapiclient import discovery
from oauth2client.client import flow_from_clientsecrets
from oauth2client.file import Storage
from oauth2client.tools import run_flow
from urllib.parse import urlencode
import requests
import json
import time as t
import pandas as pd
from datetime import datetime, timedelta
from calendar import monthrange
from dateutil.relativedelta import relativedelta
I had to make sure pip3 was actually installing to python3 and not python2.
Instead of:
pip3 install <package>
I had to do:
python3.8 -m pip install <package>
See answer here: Why pip3 install in python2 sitepackages
I had exactly the same issue...
I did this:
vim ~/.pydistutils.cfg
[install]
prefix=
see here: 24257803 for more info on this step
rm -rf [dependencies_dir]
pip3 install -r requirements.txt --target [dependencies_dir]
Pip3 will install this dependencies to Python3, where pip was installing to Python2 (where some of these packages don't exist). So when deploying to Lambda via serverless the packages weren't included.
I am trying to install Orange package
I went to their website and follow exactly what has been said following this link
https://orange.biolab.si/download/
I have anaconda and install it through command prompt Windows 10 pc
conda config --add channels conda-forge
and approved installing all additional packages
I opened my jupyter notebook and pip installed
!pip install orange3
nothing went up
import csv
import pandas as pd
import matplotlib.pyplot as plt
import Orange
from Orange.data import Domain, DiscreteVariable, ContinuousVariable
This turns out to be okay but when I do
from orangecontrib.associate.fpgrowth import *
Things do not work up as expected with the following error message
ModuleNotFoundError: No module named 'orangecontrib'
I am working as the following link
I've also faced that problem. You'll have to install the associated Orange libraries:
pip3 install Orange3-Associate
Anyone have the same issue I have for running pytest with following error. The way I install the environment is
download python from https://www.python.org/downloads/ and install pkg file
create req.file and install package by pip install -r req.file
os: x el capitan
python:3.6.1
pytest:3.0.7
pandas:2.20.2
req.file
psutil==4.0.0
pandas==0.20.2
numpy==1.10.4
py==1.4.31
pytest==3.0.7
pytest-cov==2.2.1
pytest-mock==0.10.1
script.py
import pandas as pd
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pandas/__init__.py:31: in <module>
"extensions first.".format(module))
E ImportError: C extension: umpy.core.multiarray failed to import 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.
-------------------------------------------------------------------------------- Captured stderr ---------------------------------------------------------------------------------
RuntimeError: module compiled against API version 0xb but this version of numpy is 0xa
so what i have tried is using virtual env to set up python project and reinstall all package to make sure project environment is isolated to my local. so set up virtual env and then no problem to install pandas anymore
$pip3 install virtualenv
$virtualenv --python=/usr/bin/python3.6 <path/to/new/project/>