Using python lib typer throws an error.
some of the depended stacktrace:
...
import typer
File "/builds/.../.venv/lib/python3.9/site-packages/typer/__init__.py", line 12, in <module>
from click.termui import get_terminal_size as get_terminal_size
ImportError: cannot import name 'get_terminal_size' from 'click.termui' (/builds/.../.venv/lib/python3.9/site-packages/click/termui.py)
Ah sry, i had to update to the latest version 0.4.1.
Depended pr: https://github.com/tiangolo/typer/pull/375
(Only leave this answer if anyone makes the same mistake.)
This worked for me
uninstall and reinstall ipython
pip uninstall ipython OR pip3 uninstall ipython
pip install ipython OR pip3 install ipython
next write this
if you are using on terminal/shell
pip install typer --upgrade OR
pip3 install typer --upgrade
if pip is not in PATH environment variable
python -m pip install typer --upgrade OR
python3 -m pip install typer --upgrade
if you are working on Jupyter Notebook or Google Colab
!pip install typer --upgrade
(PS:- pip is a soft link for a particular installer. pip3 is an updated version of pip which is used basically for python 3+.)
I have installed the NewsApi via my Mac OS terminal using pip3 install newsapi-python, and when I check my anaconda environment packages I see newsapi installed. However when I try to use the following command I get an error:
from newsapi import NewsApiClient
error:
ImportError: cannot import name 'NewsApiClient' from 'newsapi' (/opt/anaconda3/lib/python3.8/site-packages/newsapi/__init__.py)
Has anybody else experienced this?
Try this command in main django folder:
pip install newsapi-python
If you have saved your python filename as "news-api.py" or the same as the package name you might face this error. Try renaming your file.
Installing newsapi
upgrade pip version
pip install --upgrade pip
installing newsapi using command prompt
pip install newsapi-python
The problem: When I command import cv2 on Jupyter notebook I get a ModuleNotFoundError: "No module named 'cv2'".
What I have tried: On Anaconda I wrote py -m pip install opencv-python and also conda install opencv as suggested in this question. I also tried the command pip install opencv-python as explained in step 2 in this manual. But every time I got the same error (on Jupyter notebook).
I would like for help, thank you.
Install a pip package in the current Jupyter kernel
I've run into similar issues and this article helped me out. You can try installing it from within the Jupyter Notbeook Kernel.
import sys
!{sys.executable} -m pip install opencv-python
Article I reference
try pip3 install opencv-python
also try pip3 install opencv-python== to see all the available versions
I use Jupyter Notebook with a virtual environment.
I have a dependency installed, but can't import it:
cell 1:
!pip3 install sent2vec
Requirement already satisfied: sent2vec in
venv/lib/python3.7/site-packages (0.0.0)
cell 2:
import sent2vec
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-5-06231d291a17> in <module>
----> 1 import sent2vec
ModuleNotFoundError: No module named 'sent2vec'
How this can happen? How to fix this?
> pip3 list
Package Version
------------ ---------
certifi 2019.9.11
chardet 3.0.4
Cython 0.29.14
idna 2.8
joblib 0.14.0
langdetect 1.0.7
nltk 3.4.4
numpy 1.17.1
pip 19.3.1
requests 2.22.0
scikit-learn 0.21.3
scipy 1.3.2
sent2vec 0.0.0
setuptools 41.6.0
six 1.13.0
urllib3 1.25.7
wheel 0.33.6
You'll note that jupyter is not listed in your installed packages. That means you're running it from a different virtual environment. As I mentioned in the comment responding to your question, you can run which jupyter to find out where your Jupyter Notebook application is being run from (assuming you're on a *NIX system); in this case, it won't be from the python3.7 virtual environment that shows up in your first code block.
To resolve the issue, you simply need to run pip3 install jupyter, then retry running jupyter notebook.
Alternatively, you can add your virtual environment as a kernel so that it can be selected when you're running Jupyter from your original environment. To do this, you would run (assuming pip is connected to your original environment):
pip install ipykernel
ipython kernel install --user --name=<insert name of your venv>
You should then be able to select that venv as a kernel on new notebooks. (Source for info on venv activation in Jupyter).
Try by installing directly within Jupyter using the following command:
import sys
!{sys.executable} -m pip install your_package_name
Run this (with envname your enviroment name):
jupyter kernelspec uninstall envname
ipython kernel install --user --name=envname
Sometimes Jupyter doesnt update properly the kernels associated with enviroments.
So the solution is to uninstall it and install it again.
I had the same problem and this fixed it
It apears that you need Numpy 1.17.1(you have Numpy 1.16.0) to use sent2vec
requirements https://github.com/epfml/sent2vec/blob/master/requirements.txt
When I tried import from python terminal I get this error, although I followed all the steps to install xgboost, somehow python is unable to get the package details.I am relatively new to python, I could easily install numpy and pandas packages,I used this link for installation on MACOSX http://xgboost.readthedocs.io/en/latest/build.html
>>> import xgboost
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named xgboost
When I did pip install xgboost, I am getting this error,
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/h7/pyph_7qj6171tqp50cf2xc7m0000gn/T/pip-build-TEvbD6/xgboost/
I am getting this on printing sys path,
print sys.path
['', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload', '/Library/Python/2.7/site-packages', '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python', '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC']
First you need to get control of your python environment. Download the homebrew python by pasting these into a fresh terminal window
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
here you will be prompterd to enter your password. After homebrew is installed, install python with brew install python. Please check your installation with brew doctor and follow homebrew's suggestions.
Now, with a fresh terminal window, install xgboost from pip. Open terminal and paste this in:
pip install xgboost
I had the same issue. I tried everything but the only solution that worked for me to was to install the whl file directly from here :
http://www.lfd.uci.edu/~gohlke/pythonlibs/#xgboost
then you can do :
pip install yourFile.whl
On windows I managed to just double click on the whl file and install it
Good luck
FYI if you are using anaconda dist'n then need to do
conda install -c conda-forge xgboost
Use conda install in Anaconda Powershell Prompt then use pip install
conda install -c conda-forge xgboost
pip install xgboost
git clone --recursive https://github.com/dmlc/xgboost
cd xgboost
sudo cp make/minimum.mk ./config.mk;
sudo make -j4;
sh build.sh
cd python-package
python setup.py install
Atleast Now I can import xgboost from terminal on macosx, I haven't been able to import it in jupyter notebook as yet.
Try running
pip install xgboost
in Anaconda prompt; it's important that you do it in Anaconda prompt so it is in same location as the Python you're using.
I tried
pip install xgboost
and
pip3 install xgboost
But it doesn't work
ModuleNotFoundError: No module named 'xgboost'
Finally I solved
Try this in the Jupyter Notebook cell
import sys
!{sys.executable} -m pip install xgboost
Results:
Collecting xgboost
Using cached xgboost-1.4.1-py3-none-win_amd64.whl (97.8 MB)
Requirement already satisfied: scipy in c:\programdata\anaconda3\lib\site-packages (from xgboost) (1.5.2)
Requirement already satisfied: numpy in c:\programdata\anaconda3\lib\site-packages (from xgboost) (1.19.2)
Installing collected packages: xgboost
Successfully installed xgboost-1.4.1
Write this on the terminal of Jupyter:
conda install -c anaconda py-xgboost
On Pycharm you can go to Pycharm > Prefernces, go to the interpreter you have and install the xgboost package.
Give the following commands a try.
pip install xgboost
pip install plotly
All you need within Jupyter Notebook cell is:
try running
import sys
!{sys.executable} -m pip install xgboost
Open the terminal
Type pip install xgboost and hit enter.
Make sure your internet connection is good.
Do not forget to crosscheck the successful installation of it in jupyter.
for ubuntu 18 LTS, this worked for me.
cmake is a pre-requiste to it, so if you havent you would need to install that, currently at print its version 3.10 + minimum.
in terminal:
sudo snap install cmake --classic
in jupyter notebook(if terminal just edit it)
import sys
!{sys.executable} -m pip install xgboost
if you run
pip install xgboost
in command line and no result, run the same command in jupyter notebook.
In my case, I had multiple Python versions, and I was installing it in the wrong one.
pip install xgboost
installed the module on Python 3.7, but I needed to install it with Python 3.10. What I run was:
py -m pip install xgboost
which worked, since "py" is my binary for Python 3.10. The suitable command if you have multiple Python versions may be different depending on which version you have. In Ubuntu, for example, this worked for me:
python3.8 -m pip3 install xgboost
Windows 10, Run Anaconda as Administrator.
Launch Powershell Prompt from Navigator
pip install xgboost