import boost in python3.5 - python-3.x

I use
apt-get install libboost-all-dev
But when I import boost with python3, I get some errors
In [1]: import boost
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-1-df3240a4d6cf> in <module>()
----> 1 import boost
/usr/lib/python3/dist-packages/boost/__init__.py in <module>()
7 sys.setdlopenflags(flags)
8 else:
----> 9 import mpi
10
ImportError: No module named 'mpi'
I try to use pip3 to install the module mpi, but it seems that there has no module named mpi.
By the way, boost works well in python2.7.
What should I do?

Related

Stanza Stanford NLP: cannot import name 'StanzaLanguage' from 'spacy_stanza'

I'm getting the following error when importing StanzaLanguage from spacy_stanza:
ImportError Traceback (most recent call last)
in ()
4 import stanza
5 stanza.download('es')
----> 6 from spacy_stanza import StanzaLanguage
7
8
ImportError: cannot import name 'StanzaLanguage' from 'spacy_stanza' (/usr/local/lib/python3.7/dist-packages/spacy_stanza/init.py)
I think you've installed newest spacy-stanza but you're trying to use it with older spaCy:
As of v1.0.0 spacy-stanza is only compatible with spaCy v3.x. For spaCy v2, install v0.2.x
pip install "spacy-stanza<0.3.0"
Take a look what are the differences in Usage & Examples between them:
https://github.com/explosion/spacy-stanza vs https://github.com/explosion/spacy-stanza/tree/v0.2.x#-usage--examples

Importing Open Data set giving attribute error

I am trying to import kaggle datasets using opendatasets module but after using pandas 1.1.2 with python 3.6v it is not working.
It's giving me this error during the import:
AttributeError Traceback (most recent call last)
/usr/local/lib/python3.6/dist-packages/opendatasets/utils/network.py in <module>()
7 try:
----> 8 urlopen = urllib.request.urlopen
9 except Exception:
AttributeError: module 'urllib' has no attribute 'request'
During handling of the above exception, another exception occurred:
AttributeError Traceback (most recent call last
PS. I'm working on virtual colab files and not on a local machine
Following is the command of what i am doing
import opendatasets as od
dataset_url='https://www.kaggle.com/rohanrao/air-quality-data-in-india'
od.download('https://www.kaggle.com/rohanrao/air-quality-data-in-india')
data_dir = './air-quality-data-in-india'
!pip install jovian opendatasets --upgrade --quiet
!pip install -q kaggle
import urllib.request
import opendatasets as od
and then entering your kaggle username as well as your kaggle key allows you to import the dataset (until and unless it's not opendata set)

ImportError: No module named 'sklearn.__check_build._check_build'

ModuleNotFoundError Traceback (most recent call last)
~\AppData\Roaming\Python\Python36\site-packages\sklearn\__check_build\__init__.py in <module>()
43 try:
---> 44 from ._check_build import check_build # noqa
45 except ImportError as e:
ModuleNotFoundError: No module named
'sklearn.__check_build._check_build'
During handling of the above exception, another exception occurred:
ImportError Traceback (most recent call last)
<ipython-input-1-f14d678f34eb> in <module>()
1 from keras.models import Sequential
2 from keras.layers import Dense, Dropout
----> 3 from sklearn.model_selection import train_test_split
4 import numpy
5 import pandas as pd
~\AppData\Roaming\Python\Python36\site-packages\sklearn\__init__.py in <module>()
61 # process, as it may not be compiled yet
62 else:
---> 63 from . import __check_build
64 from .base import clone
65 from .utils._show_versions import show_versions
~\AppData\Roaming\Python\Python36\site-packages\sklearn\__check_build\__init__.py in <module>()
44 from ._check_build import check_build # noqa
45 except ImportError as e:
---> 46 raise_build_error(e)
~\AppData\Roaming\Python\Python36\site-packages\sklearn\__check_build\__init__.py in raise_build_error(e)
39 to build the package before using it: run `python setup.py install` or
40 `make` in the source directory.
---> 41 %s""" % (e, local_dir, ''.join(dir_content).strip(), msg))
42
43 try:
ImportError: No module named 'sklearn.__check_build._check_build'
Contents of C:\Users\owaisaaa\AppData\Roaming\Python\Python36\site-packages\sklearn\__check_build:
setup.py _check_build.cp36-win32.pyd__init__.py
__pycache__
It seems that scikit-learn has not been built correctly.
If you have installed scikit-learn from source, please do not forget
to build the package before using it: run python setup.py install or
make in the source directory.
If you have used an installer, please check that it is suited for your
Python version, your operating system and your platform.
I recently used the pycharm on the same machine and downloaded the packages in it. From that moment onward I am getting the above mentioned error in my jupyter notebook.
Try installing scipy and restarting python shell
Upgrading scikit-learn worked for me:
$ pip install --upgrade scikit-learn

import Axes3D issues

I'm using python 3.5 and i tried to import Axes3D from mpl_toolkitd.mplot3d but unfortunately i get this error:
In [1]: from mpl_toolkits.mplot3d import Axes3D
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-1-357f877dbd2b> in <module>()
----> 1 from mpl_toolkits.mplot3d import Axes3D
/usr/lib/python3/dist-packages/mpl_toolkits/mplot3d/__init__.py in <module>()
2 unicode_literals)
3
----> 4 from matplotlib.externals import six
5
6 from .axes3d import Axes3D
ImportError: No module named 'matplotlib.externals'
This might be arising due to duplicate installation of matplotlib in your system.
Usually pip installs all external packages to:
/usr/local/lib/python3.5/dist-packages/matplotlib
On the other hand, apt-get installs your packages in :
/usr/lib/python3/dist-packages/
Therefore, one way to resolve this would be try following (in order):
sudo apt-get remove python3-matplotlib
sudo pip3 install matplotib.

pandas_datareader not working in jupyter-notebook (Anaconda)

ModuleNotFoundError Traceback (most recent call last)
in ()
3 from matplotlib import style
4 import pandas as pd
----> 5 import pandas_datareader.data as web
6
7 style.use('ggplot')
ModuleNotFoundError: No module named 'pandas_datareader'
data reader gotta be installed separetly.
if using anacoda, try:
conda install -c https://conda.anaconda.org/anaconda pandas-datareader

Resources