Problems importing folium into IPython Notebook on Python 3.3 - python

I'm getting an error trying to import folium into an IPython notebook running on Python 3.3 in a VM. I've done a pip3 update so it shouldn't be a problem with a stale package...
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-6-af6e4f19ef00> in <module>()
----> 1 import folium
/usr/local/lib/python3.3/dist-packages/folium/__init__.py in <module>()
1 # -*- coding: utf-8 -*-
----> 2 from folium import Map
ImportError: cannot import name Map
Any ideas if this is likely to be a problem with my set up, or an issue with folium. There are a couple of other people seem to have had the same issue, but no answers that I can find?

Seems like it's a version issue and a pull request has been submitted: https://github.com/wrobstory/folium/pull/21#issuecomment-43231895

Related

Error with from pycaret.classification import *

When I tried to run
from pycaret.classification import *
I received this error:
ImportError
Traceback (most recent call last)
<ipython-input-83-a8cb12878b37> in <module>()
----> 1 from pycaret.classification import *
8 frames
/usr/local/lib/python3.7/dist-packages/sklearn/metrics/pairwise.py in <module>()
30 from ..utils._mask import _get_mask
31 from ..utils.validation import _deprecate_positional_args
---> 32 from ..utils.fixes import sp_version, parse_version
33
34 from ._pairwise_fast import _chi2_kernel_fast, _sparse_manhattan
ImportError: cannot import name 'parse_version' from 'sklearn.utils.fixes'
(/usr/local/lib/python3.7/dist-packages/sklearn/utils/fixes.py)
I uninstalled Python and re-installed it and now it works but I don't know why
Try running this code !pip install markupsafe==2.0.1. Let me know if this helps.
Please try:
import pycaret.classification
Let me know if this works
A possible resolution is to create a fresh environment. Sometimes conflicting packages cause issues so working with a fresh environment can help you determine whether this is the issue.
Let me know if this helps.
I also ran into the same issue and found this solution helpful when working on google colab, although on Jupiter it didn't, so I created a virtual environment to work in, and it worked out smoothly.

google colab. It gives this error when I execute the training code

It gives this error when I execute the training code.
ModuleNotFoundError
Traceback (most recent call last)
<ipython-input-12-08472a50f5e6> in <module>()
6 import logging
7 logging.getLogger('tensorflow').disabled = True
----> 8 import input_data
9 import resnet_utils
10 import resnet_v2
ModuleNotFoundError: No module named 'input_data'
---------------------------------------------------------------------------
NOTE: If your import is failing due to a missing package, you can
manually install dependencies using either !pip or !apt.
To view examples of installing some common dependencies, click the
"Open Examples" button below.

ImportError: cannot import name 'read_data_sets'

I am trying to move my code from my local machine which uses python 3.6 under an anaconda environment to Google Colab,in order to make use of GPU.
However,some commands are running localy,the same commands don't run in Colab,despite the fact that I have installed all missing modules(everytime I face such an error)
The problem comes at command from dataloader import get_loader,where it throws an error.
It seems that dataloader has problem,because the same error occurs when I just do import dataloader
I have installed with pip dataloader=2.0.0
I have searched a lot but I can't figure out a solution.
Error Message:
ImportError:Traceback (most recent call last)
<ipython-input-57-1c19174cb2f4> in <module>()
----> 1 import dataloader.get_loader
/usr/local/lib/python3.6/dist-packages/dataloader/__init__.py in <module>()
----> 1 from dataloader import read_data_sets
ImportError: cannot import name 'read_data_sets'

How to fix "cannot import name 'get_seomoz_data' from 'api' " error in Python

I have tried to get the Alexa ranking for a given website. I used PyPI's seolib library and installed it in my environment using !pip install seolib --user command. After executing alexa_rank = seolib.get_alexa('http://google.com') code line, I got the following error.
ModuleNotFoundError: No module named 'api'
Then I installed api module using !pip install api --user command. Then after I got this import error and I don't have an idea of how to solve this error. Please somebody help on this.
import seolib
alexa_rank = seolib.get_alexa('http://google.com')
print(alexa_rank)
ImportError Traceback (most recent call last)
<ipython-input-21-b46efa0fce9a> in <module>
----> 1 import seolib
2
3 alexa_rank = seolib.get_alexa('http://google.com')
4 print(alexa_rank)
~/.local/lib/python3.7/site-packages/seolib/__init__.py in <module>
4
5
----> 6 from api import get_seomoz_data
7 from api import get_alexa
8 from api import get_semrush
ImportError: cannot import name 'get_seomoz_data' from 'api' (/home/mylap/.local/lib/python3.7/site-packages/api/__init__.py)
I'm using Python 3.7.3 version on my environment.
seolib version 0.1.3, last release was in 2013 year. Homepage returns error 404. Doesn't look good. Old, outdated, abandoned.
The code from api import was relative import in Python 2.7, changed to absolute import in Python 3. Overall the code seems to be Python2-only.

AttributeError: module 'numpy' has no attribute 'version'

I am working on learning how to use pandas in ipython notebook:
import pandas as pd
But I get the following error:
AttributeError Traceback (most recent call last)
<ipython-input-17-c7ecb2b0a99d> in <module>()
----> 1 from pandas import *
D:\Anaconda\lib\site-packages\pandas\__init__.py in <module>()
20
21 # numpy compat
---> 22 from pandas.compat.numpy import *
23
24 try:
D:\Anaconda\lib\site-packages\pandas\compat\numpy\__init__.py in <module>()
8
9 # numpy versioning
---> 10 _np_version = np.version.short_version
11 _nlv = LooseVersion(_np_version)
12 _np_version_under1p8 = _nlv < '1.8'
AttributeError: module 'numpy' has no attribute 'version'
I have no idea about how to fix it, what is the problem?My python's version is 3.6
Numpy has dependencies and Anaconda has a history of getting them wrong leading to numpy failing to initialize properly. The AttributeError is most likely caused by numpy initialization failure. This error usually happens when updating numpy or other dependencies that change numpy versions via conda (that's why you can get numpy failing after updating Pandas...)
Example of such failure: https://github.com/ipython/ipyparallel/issues/326
The solution that always works for me is updating to a known working version of numpy. Currently, for me on Windows 10 x64, it is 1.15.1.
Please note it is a problem with Anaconda dependencies rather than numpy itself. Can't provide more specific guidance without details like OS, package versions, etc.

Categories