No module named 'mlflow.sklearn'; 'mlflow' is not a package - python

installed mlflow on my windows machine with
pip install mlflow
followed by other dependent library pandas,numpy,sklearn
Ran a tutorial on wine quality model from the give link
https://www.mlflow.org/docs/latest/tutorials-and-examples/tutorial.html
I am getting the below error.
import mlflow.sklearn
ModuleNotFoundError: No module named 'mlflow.sklearn'; 'mlflow' is not a package
I thought it may be some firewall issue, so I tried on my personal system, and it's still the same error.
What could be the mistake I am doing here? or some library related issues I am facing here?

Please make sure you are installing the package at the correct PATH.
For example, if you have different versions of Python installed on your computer, installing packages can get a little tricky and thus, it's recommended to use a virtual environment to keep packages or different installations properly organised on your computer.
Since you are using a conda environment, I would suggest to use conda install mlflow with an appropriate channel instead of pip install mlflow i.e. conda install -c conda-forge mlflow.
For more details, please check https://anaconda.org/conda-forge/mlflow.

Related

Kernel dying when setting up SpaCy environment, have tried in virtual env but same issue. How should I fix?

So as mentioned my jupyter notebook kernel dies when importing SpaCy. This error started with conflicting packages and would load a much older version of Spacy which I didn't need. So I decided to uninstall the conflicting package and reinstall the latest version of Spacy. This ended up no longer having the confliction but instantly killing the kernel.
So I'm inexperienced in managing packages etc. I'm not sure if I downloaded with conda instead of pip, I may have installed with both.
Thanks.
I solved this by uninstalling my base python download version as well as uninstalling anaconda and only using conda-forge. I must have had a conflicting package in my base python download.
Now managing all packages only with conda and also running jupyter on VSCode.

Install gdal==2.3.3 into a venv with pip

I am using anaconda with python 3.7.4 and I am working on VScode. I am currently creating a Flask webapp mostly with bokeh, that I am deploying on google app engine(gcloud). In order to work with GIS I need to install geopandas which will require gdal, fiona, rtree, shapely, pyproj, numpy, among few others. I am working in a virtual environment so I can install the .whl files directly with pip install [file.whl] and it will work locally with no problem. I also created the environment variable for gdal_data and added it to he PATH variable as well. So I have been trying to deploy the app since I installed geopandas and google is trowing me an error of gdal-config not found. I tried to dig into it with my low knowledge with dependencies and deployment. What I figured out was the following:
conda will superseded gdal 3.0.4 and install gdal 2.3.3
pip does not have this version and that when it comes to problem.
As long as I understood it google will use my requirements.txt to install the libraries I am using in my virtual environment into their cloud environment, so an error will be thrown once pip will not find the gdal 2.3.3 version that I will pass to my requirements.txt and the one I installed it manually.
Also fiona that is one of pillars of the wheel to build GIS plots is not compatible to the gdal version that conda is insisting to superseded.
I have read a lot and spend a good amount of time dealing with this error. There are a lot of info mostly for Linux, but I could not find anything to help me out.
If someone out there could help me that would be appreciated.
I had the same issue when installing gdal:
...
main.gdal_config_error: [Errno 2] No such file or directory: 'gdal-config': 'gdal-config' ...
The problem is that the underlying docker container does not have the required C libraries for running this version of gdal. So you cannot use the default app engine environment for running your application.
The solution is then to create a custom runtime (i.e. docker container) to run your app engine instance. There is another stackoverflow post which explains how to exactly do this.
The most important step is to include:
sudo apt-get install gdal-bin python-gdal

python can't find conda packages but can find pip packages

I'm sure this might be a common problem but I've scoured the StackOverflow and read through all the recommended posts that StackOverflow gave me before posting. However, I've installed tensorflow on conda but not on pip. When I run Python, I can't run import tensorflow since it gives me ModuleNotFoundError: No module named 'tensorflow'. This leads me to believe that conda installs the packages to a different place than pip, but I'm not sure how to make them install to the same place. I recall a long time ago, the problem being related to usr/bin and usr/local/bin or something, but I don't remember how that goes or the solution.
Any links / tips would be appreciated!
Please follow the below steps:
The below command will list all the environments in the system and their path
conda env list
Please activate the corresponding environment using the below command
conda activate <env_name>
You can list the pip/conda packages that you have installed in the activated environment using the below command
pip freeze
conda list
If tensorflow is not listing, please install tensorflow again using the below command
pip install tensorflow
If still you are facing issue check the PATH variable in control panel and set python path.

Tensorflow: Installing from source - ImportError: No module named pywrap_tensorflow_internal

Using machine Ubuntu 16.04.3 LTS and followed the steps defined in the documentation here. I'm only building for CPU.
I've managed to follow all the steps successfully until I reach the sectionInstall the pip package which states that:
Invoke pip install to install that pip package. The filename of the .whl file depends on your platform. For example, the following command will install the pip package
for TensorFlow 1.2.1 on Linux:
$ sudo pip install /tmp/tensorflow_pkg/tensorflow-1.2.1-py2-none-any.whl
Problem 1: However, I've not been able to find any .whl file. Where can I find this file?
Problem 2: When I try to import tensorflow, I get the following error:
ImportError: No module named pywrap_tensorflow_internal
Problem 3: If I try to import tensorflow from any other directory, I receive the error
ImportError: No module named tensorflow
It seems it can find the path to the tensorflow. How do i change that?
It seems that some issues has happened in your pip that sometimes they are hard to find, because original pip is system-wide, which can cause some unexpected such as dependency issues, etc.
It is good idea to use Anaconda. It is a python data science platform. It can be deemed as a large py package extendable bundle with a python virtual environment tool called conda. You can create many isolated python environments with installing and updating py packages you need. Almost packages which can be found in PyPI using pip can also be found in Anaconda.
You can also use pip to install packages that anaconda do not contains for even pip is one package in it. All environments and packages are in your /home/(..user..)directory if you install without sudo as default.
For example (no worry about package dependancy):
[chain#ChainFedora Project]$ conda install tensorflow
Fetching package metadata .........
Solving package specifications: .
Package plan for installation in environment /home/chain/anaconda3:
The following NEW packages will be INSTALLED:
backports.weakref: 1.0rc1-py36_0
libprotobuf: 3.2.0-0
markdown: 2.6.8-py36_0
protobuf: 3.2.0-py36_0
tensorflow: 1.2.1-py36_0
Proceed ([y]/n)?
Very easy to get started with conda cheat sheet

No module named sklearn

I am trying to install sklearn module through pip, but below is the error i am encountered.
I think error code 1 actually refers to missing Lapack/Blast dependencies on your windows installation. Lapack/BLAST are requirements for most scientific Python packages for example : numpy, scipy, sklearn etc...
You could either build these for source and then pip install sklearn
Instructions for this here > http://www.scipy.org/scipylib/building/windows.html
Or just install anaconda and not have any of these issues. If you want to do advanced data analytics with Python, I would recommend using Anaconda especially in windows machine where any scipy package installation will be like fighting with windmills
Instructions how to get Anaconda here > https://www.continuum.io/downloads#windows
Further tip. I would go with Anaconda full 3.6 for your dev machine so you have all that you might need out of the box. This includes popular science, data manipulation and math packages + Jupyper (iPython) notebooks and Spider IDE for development.
For server you only want required packages so use miniconda there.
Just install Anaconda and there type in conda install scikit-learn in the console.

Categories