import Statsmodels issue - python-3.x

I have the latest Anaconda distribution and running Jupyter notebooks 6.0.2 with Python 3.7.
I am trying to import statsmodels and I am getting the following error.
I have done the
pip install statmodels
import statsmodels.api as sm
or
import statmodels
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-1-2fcb280597c8> in <module>
----> 1 import statmodels.api
ModuleNotFoundError: No module named 'statmodels'
Please help

Doing the following worked for me.
pip install git+https://github.com/statsmodels/statsmodels

Related

Python - import cv2 after installation vidgear

I installed RasPiOS Bullseye OS in my Raspberry Pi zero, with Python 3.9.2.
I installed opencv with
sudo apt install python3-opencv -y
I test import cv2 and it works. Then I installed vidgear with pip3 install vidgear .
I test import cv2 and not works:
RuntimeError: module compiled against API version 0xf but this version of numpy is 0xd
Traceback (most recent call last):
File "", line 1, in
ImportError: numpy.core.multiarray failed to import
Numpy version is 1.19.5. The same version that was there before installing vidgear.
I tried pip3 uninstall numpy and pip3 install numpy==1.19.5 , but don't work, same error.
Can you help me, please?
thank you,

Import Simpy in Python 3

I am unable to import simpy in Python 3. It gives me this error
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-6-076c1059698e> in <module>
----> 1 import simpy
ModuleNotFoundError: No module named 'simpy'
Please tell me a way to do so?
Make sure the package is installed and available in your environment, as that is a common error when the package is not present.
Run:
pip install simpy
or if you have separate Python versions on your system:
pip3 install simpy
Or, if installing from the source code:
python setup.py install
or,
python3 setup.py install

Cannot import tensorflow in Spyder but it imports in python

I installed Anaconda on my machine and created a separate environment for tensorflow. Installed tensorflow and keras ok but both packages cannot be imported. The error is:
In [1]: import tensorflow
Traceback (most recent call last):
File "<ipython-input-1-88d96843a926>", line 1, in <module>
import tensorflow
ModuleNotFoundError: No module named 'tensorflow'
Dependencies that were installed during the install like scipy and yaml can be imported.
When I run python3 from the command line I can import keras and tensorflow correctly. This fails when I try to import tensorflow in Spyder.
I rebooted, uninstalled and installed again. I am sure that I am in the correct environment. Does somebody know what I do wrong?

Cannot import spacy -Jupyter python 3 notebook

I am trying to create a jupyter notebook for an NLP project and I am failing to import spacy. I get the error below
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-102-728c089140d2> in <module>
6 import numpy as np
7 import re
----> 8 import spacy
9
10 # libraries for visualization
ModuleNotFoundError: No module named 'spacy'
May anyone help with suggestions ?
If you're using Conda:
import sys
!conda install --yes --prefix {sys.prefix} spacy
Otherwise, use pip:
import sys
!{sys.executable} -m pip install spacy

numpy intalled with pip but not found (in virtualenv)

In an AWS EC2 instance, with Amazon Linux AMI 2016.09 distribution, I have installed numpy, inside my virtualenv where python 3.4 is the default version, with:
pip install numpy
It installs package numpy-1.12.1-cp34-cp34m-manylinux1_x86_64.whl without errors.
After that, in python I try to import it:
>>> import numpy
And I get:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'numpy'
Moreover, if I run pip freeze, numpy does not appear in the list.
Why is numpy not being found? and How to fix it?
Did you do this:
#:source .venv/bin/activate
.....
#:python
....
>>>pip3 install numpy
....
This works!

Resources