I am trying to use XGBoost on Sagemaker notebook.
I am using conda_python3 kernel, and the following packages are installed:
py-xgboost-mutex
libxgboost
py-xgboost
py-xgboost-gpu
But once I am trying to import xgboost it fails on import:
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-5-5943d1bfe3f1> in <module>()
----> 1 import xgboost as xgb
ModuleNotFoundError: No module named 'xgboost'
In Sagemaker notebooks use the below steps
a) If in Notebook
i) !type python3
ii) Say the above is /home/ec2-user/anaconda3/envs/python3/bin/python3 for you
iii) !/home/ec2-user/anaconda3/envs/python3/bin/python3 -m pip install xgboost
iv) import xgboost
b) If using Terminal
i) conda activate conda_python3
ii) pip install xgboost
Disclaimer : sometimes the installation would fail with gcc version ,in that case update pip version before running install
Related
I cant import pycaret in a google colab
Here are all the steps I had taken:
Change python version to 3.8
Installed pip
I then ran
!pip install pycaret
import pycaret
the install works, but then
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-27-fdea18e6876c> in <module>
1 get_ipython().system('pip install pycaret ')
----> 2 import pycaret
ModuleNotFoundError: No module named 'pycaret'
I must be doing something very wrong!
In troubleshooting I also pip installed numpy and pandas which both imported just fine
For importing use this, this is one is for classification:
from pycaret.classification import *
And for regression:
from pycaret.regression import *
For NLP:
from pycaret.nlp import *
!pip install pycaret
should work without any issues. I have used it multiple times on Google Colab. Alternately, you can use
pip install --pre pycaret
I have installed sklearn through pip successfully using this command:
$pip install -U scikit-learn
But I cannot import it.
import sklearn
Result:
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-1-b7c74cbf5af0> in <module>
----> 1 import sklearn
ModuleNotFoundError: No module named 'sklearn'
Please help
You might want to try installing scikit-learn: pip install scikit-learn
Try pip3 install sklearn.
This will install the libraries you need for python 3.
I'm trying to import PyMC3 library in Jupyter Notebook's Python 3 kernel. I've already installed pymc3 initials in Anaconda Prompt (Miniconda3) using:
conda install theano
conda install pygpu
pip install pymc3
And when I try to import it in Jupyter Notebook:
import pymc3 as pm
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-1-1f817cf6472a> in <module>
1 # PyMC3 for Bayesian Inference
----> 2 import pymc3 as pm
ModuleNotFoundError: No module named 'pymc3'
Any solutions to this problem guys...
You have installed the pymc3 to other python environment that you are using to import it.
Check your python executable location
Inside your script, use
import sys
print(sys.executable)
To get the path to the python executable you are using. Lets say it is C:\python\python.exe.
Install the package
Then, install the package using
<path_to_python.exe> -m pip install pymc3
This is the bulletproof way installing packages with pip, when you have multiple python installations or virtual environments on your system.
I have tried installing fasttext through conda using two channels:
conda install -c conda-forge fasttext
and
conda install -c conda-forge/label/cf201901 fasttext
as per (https://anaconda.org/conda-forge/fasttext).
I am using the following command to import: import fasttext
However, the import fails with the error:
ModuleNotFoundError Traceback (most recent call
last) in
----> 1 import fasttext
ModuleNotFoundError: No module named 'fasttext'
However, tried to import it in an older fashion import fastText, which failed.
Have tried it on python and python3, both of which fail.
I want to avoid installing it using pip and manage the packages using conda.
conda list shows that fasttext being installed. The output of which is shown below:
fasttext 0.2.0 hfc679d8_1 conda-forge/label/cf201901
The output of python -c 'import sys; print(sys.path) is as below:
['', '/<dir>/<dir>/anaconda3/lib/python37.zip', '/<dir>/<dir>/anaconda3/lib/python3.7', '/<dir>/<dir>/anaconda3/lib/python3.7/lib-dynload', '/<dir>/<dir>/anaconda3/lib/python3.7/site-packages']
I used fastText in this way:
!git clone https://github.com/facebookresearch/fastText.git
!cd fastText
!pip install fastText
import fasttext.util
fasttext.util.download_model('en', if_exists='ignore') # English
model = fasttext.load_model('cc.en.300.bin')
Note 1: Pay attention to uppercase letters.
Note 2: Here is the list of supported languages.
Hi I am using Jupyter notebook to run my python script.I did all the steps to install tensorflow. When I do list env I see tensorflow installed but when I write a script using tensor flow. I get the following error.
ImportError Traceback (most recent call last)
<ipython-input-1-b2d6c7d62f65> in <module>()
2 import numpy as np
3 #import tflearn
----> 4 import tensorflow as tf
5 import tflearn
6 #from tflearn.data_utils import to_categorical
ImportError: No module named 'tensorflow'
Can anyone please help in how to debug
I have followed the following steps
1.conda create --name test python=3.5
2.activate test
3.conda install numpy matplotlib pandas jupyter notebook
4. conda install tensorflow scipy
all the installations were successfull. Except in hdf5 i got error saying revuild using conda > 2.0
If you're trying to import tensorflow in ipython, you should also make sure that ipython is installed in the same environment. And if you run
ipython notebook
This will launch the default ipython (/usr/bin/ipython). You don't want that. So, run venv/bin/ipython instead