xgboost is recognized in terminal but not in Rodeo GUI
I've been trying to install xgboost since last night, but I just can't seem to get it to work. My latest development so far is that I am able to successfully call on the module when using the terminal, but it has an ImportError when using my Rodeo GUI, also in atom-hydrogren. Any tips how I can call xgboost for these?
Here 's a screencap for importing xgboost:
Success:
Failure:
>>> import xgboost
ImportError: No module named xgboost
Rodeo and Mac Terminal use different versions of Python and obviously different PYTHONPATH with their own set of libraries.
When you installed xgboost with git, you used the Terminal which is configured to use Python 2.7.10 (probably pre-installed with the OS). However, it is not installed in the package site that Rodeo uses.
You have two options:
Make Rodeo use the package site that the Terminal uses
Install xgboost in Rodeo's package site
Since you stated that Rodeo is installed alongside with Anaconda, I'd go with option 2. Anaconda has a lot of useful packages pre-installed that don't come along with the pre-installed libraries that the Terminal uses.
You could follow this link to install xgboost in Anaconda. After which, it should work fine with Rodeo.
Otherwise, you could try this code directly in Rodeo:
import pip
pip.main(['install','xgboost'])
If xgboost cannot compile, then it means that you don't have a compatible compiler to build it. To build it in a Mac, do the following (provided you have Homebrew)
brew install gcc5 --without-multilib
and then install xgboost with pip.
Related
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.
I have recently installed Spyder 2 on my MacBook. Then, since I couldn't import the sklearn library, i decided to also download Anaconda from their Website. Now, Anaconda comes with a Spyder environment itself, on which I can import sklearn, however the IDE is laggy. Is there a way to use the conda sklearn library on my separately downloaded Spyder (which runs much smoother)? Both Spyders are running Python 3.9.5 and I'm using MacOs 10.15.7
I tried setting a path via the PYTHONPATH Manager, but Spyder 2 forbids setting a path to 'site-packages' and after copying sklearn into another folder and setting a path there, import failed:
ModuleNotFoundError: No module named 'joblib'
I also installed sklearn via pip on the terminal, but I run into the same kind of problems if I try to import sklearn in my seperate Spyder 2('no module named sklearn found' or I can't set a path there or some module is missing).
And if I try to run
pip install scikit-learn
in the IPython console directly, I get
/Applications/Spyder 2.app/Contents/MacOS/python: No module named pip
while if I try
conda install scikit-learn
in the IPython console I get
ValueError: The python kernel does not appear to be a conda environment. Please use ``%pip install`` instead.
So I seem to be running in circles...
conda and pip are executables and not to be run from the IPython console, but from a command shell.
Don't mix conda and pip installations if you don't have to. Only install scikit-learn with conda.
Before you can use any installation, you have to activate the base environment first with conda activate.
There is no shame in reading the documentation first, e.g. https://docs.anaconda.com/anaconda/user-guide/getting-started/
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.
I recently installed Anaconda on Arch Linux from the Arch repositories. By default, it was set to Python3, whereas I would like to use Python2.7. I followed the Anaconda documentation to create a new Python2 environment. Upon running my Python script which uses Numpy, I got the error No module named NumPy. I found this rather strange, as one of the major points of using Anaconda is easy installation of the NumPy/SciPy stack...
Nevertheless, I ran conda install numpy and it installed. Now, I still cannot import numpy, but when I run conda install numpy it says it is already installed. What gives?
Output of which conda: /opt/anaconda/envs/python2/bin/conda
Output of which python: /opt/anaconda/envs/python2/bin/python
The anaconda package in the AUR is broken. If anyone encounters this, simply install anaconda from their website. The AUR attempts to do a system-wide install, which gets rather screwy with the path.
I have keras installed on my linux machine, but when I try to import a dataset from the keras.datasets I get an error that it cannot find it.
So for example:
from keras.datasets import mnist
I get the error
ImportError: No module named keras.datasets
I installed keras using pip install and it installed successfully.
Indeed the problem was that I had multiple versions of Python.
Removing Anaconda Python and installing all libraries using pip / apt-get instead of conda solved my problem.
I found this to be true but it is not necessary to delete anaconda.
I had the same issue but with multiple python versions. However, i created an environment that only used the Anaconda version (while in that environment). In terminal (on mac and other suitable terminals), type/copy
conda create -n dataweekends python=2.7 pandas scikit-learn jupyter matplotlib
dataweekends is simply the name of the environment you created. To access this, just use the command
source activate dataweekends
Be mindful that you might (probably) have to reinstall dependencies once in that new environment.
I got this trick from here "https://www.dataweekends.com/blog/2017/03/09/set-up-your-mac-for-deep-learning-with-python-keras-and-tensorflow"
I would also recommend setting up different environments for each project you do in python.
Do you have keras.py or keras.pyc in the current working directory? If so, this will mess up the imports. Try renaming the file and/or deleting keras.pyc.
Thanks to the comment from Selcuk which got me on the right track.
Indeed the problem was that I had multiple versions of Python.
I followed some online instructions to installing Keras which recommended installing MiniConda/Conda/Anaconda which is its own version of python. So I had two Python2.7 versions installed:
Normal Linux Python 2.7
Anaconda Python 2.7
Removing Anaconda Python and installing all libraries using pip / apt-get instead of conda solved my problem.