Python on anaconda cannot find azure.mgmt.datafactory - python

I am trying to run this tutorial
https://learn.microsoft.com/en-US/azure/data-factory/quickstart-create-data-factory-python
but I fail to install the packages. I tried several installations but I keep getting the error No module named 'azure.mgmt.datafactory' when trying to run from azure.mgmt.datafactory import DataFactoryManagementClient.
I am using anaconda and windows 10.
I tried running the recommended anaconda packages https://anaconda.org/anaconda/azure and https://anaconda.org/clinicalgraphics/azure-mgmt-resource under a python 3.5 environment and I also tried to manually install everything from github (https://github.com/Azure/azure-sdk-for-python) using
git clone git://github.com/Azure/azure-sdk-for-python.git
cd azure-sdk-for-python
python setup.py install
In both the normal (Python 3.6) and the new (Python 3.5, using Anaconda version with Python 3.5) environment. None of this worked.
What am I missing?
(Note that from azure.mgmt.resource import ResourceManagementClient worked fine with the anaconda installation)
EDIT
After the first response, I ran the following commands from the powershell
pip install azure-mgmt-resource
pip install azure-mgmt-datafactory
pip install azure-mgmt
which resulted in ModuleNotFoundError: No module named 'azure.mgmt'
Uninstalling the three packages and installing azure-mgmt as a first one did not solve the issue either. However, I don't know how to uninstall the manually installed package from python setup.py install, which still might be an issue.

Have you tried pip install in powershell/cmd?
pip install azure-mgmt-datafactory
Update (Jan's answer):
pip freeze > requirements.txt
pip uninstall -r requirements.txt
python -m pip install azure-common
python -m pip install azure-mgmt
python -m pip install azure-mgmt-datafactory (this might not be needed as it comes with azure-mgmt)

Ok, this is how I got the required azure libraries to work (thx to Saul Cruy, who gave me the idea)
Using this post What is the easiest way to remove all packages installed by pip?, I created a requirements file in PowerShell
pip freeze > requirements.txt
In this file, I manually kept only the entries with azure.
Then, I deleted all packages in the file
pip uninstall -r requirements.txt
The steps above were repeated twice, as upon first delete, some azure packages survived.
Then, I ran (all in PowerShell, in that order)
python -m pip install azure-common
python -m pip install azure-mgmt
python -m pip install azure-mgmt-datafactory
The reason might(!) be that installing packages in the anaconda console using the conda commands causes confusion in the dependencies (I tried a similar approach in a conda environment as it seemed like a good idea to seperate the azure packages from the other ones, but without success).

Related

No Module named 'fastapi' - Ubuntu environment

Though I have pip and pip3 installed fastapi library in my Ubuntu based workstation, I get a weird error saying
No module named 'fastapi'.
I have been scratching my head since two days ago as the same code works in other laptop with same Ubuntu environment.
Uninstalled and reinstalled fastapi library
you're not using the correct environment to run your code.
Either, 1. install the package fast-api in the environment you running the code in or 2. switch to the other one the packages are installed in:
for 1:
sudo /bin/python3 -m pip install "fastapi[all]"
in this case you should be able to use the fast-api package
Note: the other packages you use are probably not installed as well
Maybe you are using the wrong env? It looks like you're using vscode so you can specify the interpeter
Try pip install --upgrade pip and then pip install fastapi again
Try using conda, and do conda install -c conda-forge fastapi

Installing a repo not in PyPI

This is my first time trying to install a repo not in PyPI. I'm not sure if I'm having a general issue or a specific issue with the package.
Repo:
https://github.com/jeslago/epftoolbox
Instructions are:
git clone https://github.com/jeslago/epftoolbox.git
cd epftoolbox
Then, simply install the library using pip:
pip install .
I've tried several approaches.
I tried adding the repo in Pycharm, as "https://github.com/jeslago/epftoolbox.git/" in the settings.
I tried using pip install from a local version of the repo
python -m pip install C:\Users\user\epftoolbox\
I tried installing in anaconda
git clone https://github.com/jeslago/epftoolbox.git
cd epftoolbox
pip install .
I get this error
Successfully built epftoolbox termcolor
ERROR: tensorflow 2.3.0 has requirement scipy==1.4.1, but you'll have scipy 1.5.2 which is incompatible.
But it finishes with "Successfully installed epftoolbox-1.0"
The issue is that I can do "import epftoolbox"
Fine. But if I try and run a script with "from epftoolbox.data import read_data"
I get the error
ModuleNotFoundError: No module named 'epftoolbox.data'
So I take it that the package didn't actually install?
I'm not sure what to try next?
I've python 3.8.5 installed 64 bit.
I've get the same issue in pycharm and idle.
Probably you need to install specific version of scipy to work with this library, try to uninstall current version and then install the correct version with this commands:
python -m uninstall scipy
python -m install -Iv scipy==1.4.1

Python 2.7: No module named setup tools

I am trying to clone and install the keras package from github. When I run sudo python setup.py install, it says no module named setuptools. I looked at some posts that were for python 3; however, this solutions did not work for me. I am working on a terminal from a windows computer. I am using python 2.7. I tried the following commands: python -m pip install -U pip setuptools from this website: https://packaging.python.org/installing/. However, nothing seemed to work.
If you are working on Windows then you should be typing batch commands, not bash (Linux, OSX), therefore, sudo ... should not be used by you.
Firstly, I would recommend to install pip, it will make package update and installation a lot easier. Save it as get-pip.py and run the following in the directory the file is located python get-pip.py. Official pip website.
Then install upgrade pip which will also install the latest versions of setuptools and wheel with this python -m pip install -U pip setuptools.

Installing requests-kerberos on Windows

Is there any way to install requests-kerberos on Windows?
When I try to install it with pip I have the following error:
py -m pip install requests-kerberos
ImportError: No module named 'commands'
Command "python setup.py egg_info" failed with error code 1 in C:\Users\user1\AppData\Local\Temp\pip-build-n8s_inn\kerberos
I would be grateful if anyone knew another kerberos module. I'm using Python 3.4 and Windows 8.
Best regards.
The commands module was deprecated in python 2.6.
Thus, the issue appears to be a problem with your pip installation, and not with requests-kerberos.
There are a few things you can try, but I would focus on ensuring pip is working correctly. While you could install the package manually, you are really just pushing the pip problem down the road until the next time you install a package.
Ensure pip is installed correctly.
Use the pip command to ensure you are running pip in the python 3.4 context: (Note, this is my output, yours will be different because you are on Windows and running 3.4)
$ pip --version
pip 1.5.6 from /Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg (python 2.7)
Additional information about pip can be found here.
Download and install manually
Download the package manually from the pypi repo.
Download the .tar.gz
Extract the tar.gz and run python setup.py install

How can I pip freeze and get only pip --user installs, no system installs?

I have dutifully uninstalled all the Python packages I installed with sudo pip install and installed them with pip --user install instead. Yay me :)
On Ubuntu, I know I can find the relevant binaries at /home/<USERNAME>/.local/bin and the packages themselves at /home/<USERNAME>/.local/lib/python2.7/site-packages ... but navigating there is not as simple as good old pip freeze.
How can I pip freeze and get only the packages I installed with pip --user install rather than all the Python packages, including those installed via apt?
Currently pip does not have any such options. So with default pip its not possible. (and I submitted a feature request and now there is a working PR too!)
However I wrote a little script, which does solve your problem:
# pip_user_installs.py
import sys
import pkg_resources
for module in pkg_resources.working_set:
if sys.argv[1] in module.location:
print module.project_name
usage:
$ python pip_user_installs.py $HOME
It's fairly easy in recent versions of pip (the PR in the other answer is now part of pip).
pip freeze --user
This will output a list of packages currently installed to the user's site-packages.

Categories

Resources