Why is a package I have installed not getting recognised - python

I have installed a package named hypixel for my discord bot using pip install hypixel. It finished installing without any errors. At the top of my script I have import hypixel. But when I try and run it I get this error:
File "D:\Documents\Discord Bot\Addicts Discord Bot\bot.py", line 1, in <module>
import hypixel
ModuleNotFoundError: No module named 'hypixel'
I am not sure if this is too relevant but my pip isn't the latest version and I get an error when I try and update it.
Edit: I have now successfully updated my pip. But even when I try and reinstall the package it still won't work.

Instead of using pip install python, use pip install hypixel. Then try to import it in your code using import hypixel.

In your question you say you used pip install python, did you mean to say pip install hypixel?
Also if you use python3 but have python3 installed make sure you use pip3.
You can install this with sudo apt-get install python3-pip (assuming you use a debian based distro). Then use sudo pip3 install hypixel
Edit:
For windows installation follow this link

Related

Python pip module issues on Kali Linux

I am on my Kali Linux. When I run sudo python3 Storm-Breaker.py, I get an error
ModuleNotFoundError: No module named 'pyngrok'
But when I import pyngrok in an ordinary python file and then run it, it works out fine.
Please please help.
You shall install the package before using it.
Run the following command to install the package and its dependencies.
pip install pyngrok
You can try using the following command
sudo pip3 install -r requirements.txt

Python - Notion API - Can't import module

I'm trying to use Notion API for some automation processes but I am having some trouble importing the packages and I already try a lot of imports. I've this code:
from notion_database.database import Database
my_token = "my_token"
D = Database(integrations_token=my_token )
print(D.list_databases(page_size=100))
To run this code I made the following imports:
pip install notion-database
pip install notion-py
pip install "notion==0.0.25"
pip install notion
All of them were installed correctly and I don't have my script name as "notion.py" :D
But when I run my code I got:
from notion_database.database import Database
ModuleNotFoundError: No module named 'notion_database'
Does anyone know what I am doing wrong?
Thanks for the help!
It looks your code is fine.
More likely, your python and pip points onto two different python versions.
I would suggest you create an environment (virtualenv or pyenv) and reinstall the packages using this command:
sudo python -m pip install notion-database
sudo python -m pip install notion-py
sudo python -m pip install "notion==0.0.25"
sudo python -m pip install notion
maybe you have not install notion successfully.
try to replace pip install notion
to pip install notion --user
,after that maybe there is no error with run "import notion".
good luck!

No module named 'fbchat'

So im new at python and programming and trying to work out the basic of fbchat which seems very manageable but I keep getting this error: ModuleNotFoundError: No module named 'fbchat' I'm 100% sure that I've installed fbchat by using:
pip install fbchat
and have also tried
git clone https://github.com/carpedm20/fbchat.git
pip install fbchat
Either way I still get the same error.
This is the code:
import fbchat
session = fbchat.Session.login("<xxxxxx#hotmail.com>", "<xxxx>")
print("Own id: {}".format(session.user.id))
session.user.send_text("Hi You!")
session.logout()
I really hope that you can help me with this problem, thank you for your time
First check your pip version is using desired python or not
pip --version
If not then you should use different pip version for an example if you're using python3 then install using pip3
If there's no issue of version then try to use virtual environment
create one using
python -m venv venv
source venv/bin/activate
pip install fbchat
Refer this link for os wise instructions
https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/
Install using Python3.8 -m pip install fbchat

TFTPy import, no module named tftpy

I installed TFTPy with both pip and pip3.
Then i followed the example on the TFTPy documentation, which follows:
import tftpy
server = tftpy.TftpServer('/tftpboot')
server.listen('0.0.0.0', 69)
But I get the error
ImportError: No module named tftpy
I also tried using from tftpy import tftpy. I tried using Python 2, Python 2.7 and Python 3, but still get the same error.
All help is appreciated
You can install tftpy by using command pip install tftpy. In case you do not have pip on your device, use the following commands:
yum -y install python-pip
pip install --upgrade pip
pip install tftpy

ImportError: No module named 'pyrebase'

I'm currently working on a project with my raspberry pi. In this project I want to connect my raspberry to google firebase, therefore I have to use:
import pyrebase
I have installed pyrebase in terminal with:
pip install pyrebase
Also I'm aware that pyrebase doesn't support python 2, so i'm using python 3.4.2. I don't know why python can't find it, any ideas or suggestions?
If you have multiple versions of python installed, it may be confused on which version of pyrebase to install.
Try:
pip3 install pyrebase
Try to import like this:
from pyrebase import pyrebase
Works for me.
pip3 install pyrebase4
if this doesn't work
write this:
pip install pycryptodome
then
pip install pyrebase
Check if the pip you're using is working with your python version
pip --version
pip 8.1.2 from c:\python27\lib\site-packages (python 2.7)
Mine is working with python 2.7.
If you're working with the right python version try pip freeze or pip list to see the list of currently installed libraries, and check if the one that you're trying to install is there.
The Best Option is to install Ubuntu Mate in your raspberry pi as i have tried this on debian and got the same problem for absolutely no reason!! so i installed ubuntu mate and here you go it worked!!
pip install pyrebase <br>
This is for python 2.x
Please install python 3.x and pip3.x instead, then run
`pip3.x install pyrebase`
I was getting the "import error" of pyrebase. After checking this link I got the idea of problem, but was unable to find proper solution. After struggling for a day, I got the Solution. As I was using PYREBASE for my Engineering Project, I re-installed RASPBIAN-JESSIE stretch image on SD. Removed python2.7 and python3 and again installed python3 and then installing pyrebase and with frequent reboots. but it worked!
$ sudo apt-get remove python2.7
$ sudo apt-get remove python3
$ sudo reboot
$ sudo apt-get install python3
$ wget https://bootstrap.pypa.io/get-pip.py
$ sudo python3 get-pip.py
$ pip3 freeze #(displays about 15 lines, if pip is installed correctly)
$ pip3 list #(displays about 15 lines)
$ sudo pip3 install pyrebase
and now,
from pyrebase import pyrebase
and it did not gave import error.
For some reasons pyrebase Lib will only works in pycharm ide.
donwload Pycharm IDE Here !
1- Start Clean:
pip3 uninstall pyrebase4
pip3 uninstall pyrebase
2- Install Lib
pip3 install pyrebase
3- Restart your PC.
4- Run pycharm ide as administrator
5- Import it in Python:
from pyrebase import pyrebase
You should have it to work now!
This will work on latest versions of python
pip install pyrebase4

Categories

Resources