ImportError: cannot import name GLM - python

I installed pymc3 from pip and was going through getting started
http://pymc-devs.github.io/pymc3/notebooks/getting_started.html
Towards the end they use GLM -
from pymc3.glm import GLM
Which returns error "ImportError: cannot import name GLM"
I am able to import other modules of pymc3.glm. For eg this works-
from pymc3.glm import families

install the module with pip3
sudo pip3 install git+https://github.com/pymc-devs/pymc3
use python 3
then it should be fine

Try updating your pip once through :
pip install --upgrade pip
or
python -m pip install --upgrade pip
Even if doesn't solve the problem, there might be some problem with the module's version for 3+. In this case, try to go back to a stable 2.7 version.

Related

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!

pip install pandas not working even though it seems I have got pip

I have installed Python on Windows though it is not in my PATH variable. I want to use pandas
When I do import pandas, I get error that pandas modules can't be found
When I do pip install pandas, I get error that pip is not a command
When I do python -m pip --version, I can see pip
Why am I not able to use pip?
I had to first update pip (optional I think) - python -m pip install -U pipand then use it like thispython -m pip install pandas`

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

Why is a package I have installed not getting recognised

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

ImportError: No module named hmmlearn.hmm python 2.7

I got this error in python script:
from hmmlearn.hmm import
GaussianHMM I know I need some libraries thats why I ran following
git clone git://github.com/hmmlearn/hmmlearn.git
pip install -U --user hmmlearn
I getting stuck because of this problem. I didn't get any solution, I tried google and many commands but problem still happen.
I solved this by cloning the repository and running:
sudo python setup.py install
It seems like according to the git-hub page of the repo it requires specific versions of some packages. Make sure you do a pip upgrade for all those packages
Python >=2.6
numpy >= 1.9.3
scipy >= 0.16.0
scikit-learn >= 0.16
then try it will work
to upgrade a package do simple
pip install --upgrade <package-name>

Categories

Resources