Using basemap fillcontinents with color causes error - matplotlib-basemap

Packages versions:
basemap : 1.2.2
matplotlib : 3.5.1
GEOS : 3.9.1
With this code I get the following map, in which fillcontinents doesn't cover the Antarctic region :
from mpl_toolkits.basemap import Basemap
import matplotlib.pyplot as plt
m = Basemap(projection='cyl',llcrnrlat=-90,urcrnrlat=90,\
llcrnrlon=-180,urcrnrlon=180,resolution='c')
m.drawcoastlines()
m.fillcontinents(color='grey')
plt.show()

Currently (22 April 2022), basemap works well only with GEOS < 3.9 (see basemap #522). This problem with Antarctica is known to appear with GEOS >= 3.9. Until the bug is solved, a GEOS downgrade should fix your problem with the Antarctica coastline.
EDIT (2022-10-26): Since basemap version 1.3.5, the bug related to the drawing of Antarctica is solved. The precompiled wheels in PyPI are still linked to GEOS 3.5.1, but a user installing from the source distribution will be able to link basemap to GEOS >= 3.9 and now Antarctica would also be drawn correctly for the case of the OP.

Thanks #molinav problem solved by downgrading GEOS from 3.9 to 3.8.1 by
pip install geos==3.8.1
and now the map looks like that :

Related

Compatibility issue with rasa

Cannot convert a symbolic Tensor (dialogue_encoder/strided_slice_4:0) to a numpy array.
I am getting this error with using rasa==1.10.3 having tensorflow of 2.2 and numpy==1.18.5
Try to upgrade numpy to numpy 1.19.5
pip install numpy==1.19.5
This should fix the problem.
Also for Rasa's version, I am afraid rasa==1.10.3 is not a supported version. You can check the Compatibility Matrix from here:
https://rasa.com/docs/rasa-x/changelog/compatibility-matrix/

Visual Studio Code does not render ipywidgets correctly

I am having issue using Visual Studio Code. the code seem to have issue with ipywidgets.
the code is below (very simple interactive chart)
from ipywidgets import interact
import ipywidgets as widgets
import numpy as np
import plotly.graph_objects as go
#interact
def foo(beta=(-10,10,1)):
myx = np.arange(0,100,1)
myy = myx *beta
print ('debug:',myy)
fig = go.FigureWidget()
fig.add_scatter(x= myx, y=myy)
fig.show()
the same code works just as expected in Jupyter Notebook.
I dig further and it seems:
"widgets require us to download supporting files from a 3rd party website. Error loading plotlywidget: ^4.14.3
https://github.com/microsoft/vscode-jupyter/wiki/IPyWidget-Support-in-VS-Code-Python
This is where I got stuck.. What's the next then to fix this issue?
any guidance much appreciated
thanks
Some of the issues I've seen reported seem to have started after the release of ipywidgets 8.
I don't understand exactly what's broken (or if it's broken), but downgrading to version 7.7.1 fixed all issues I was having.
If you want to try it as well, you can run: pip install -U ipywidgets==7.7.1
There two things you can explore.
Check modules:
Run the jupyter --version command inside your conda or virtual environment.
You should see something like this:
IPython : 8.4.0
ipykernel : 6.9.1
ipywidgets : 7.7.1
jupyter_client : 7.2.2
jupyter_core : 4.10.0
jupyter_server : 1.21.0
jupyterlab : 3.4.8
nbclient : 0.6.4
nbconvert : 6.5.0
nbformat : 5.4.0
notebook : 6.4.12
qtconsole : not installed
traitlets : 5.4.0
If there are any of those modules not installed (Apart from qtconsole) try installing them (with pip install "module") and restarting the kernel.
Check Jupyter nbextension.
As mentioned here after running pip install ipywidgets try:
jupyter nbextension enable --py widgetsnbextension
Note: If you are using virtual environments (including conda environments) the recommended way to activate the extension is to run
jupyter nbextension enable --py --sys-prefix widgetsnbextension
I hope this helps.

Watson Studio Very Slow

I am using jupyter notebook on Watson Studio and installing python libraries is taking very long time.
for example the following lines of code would take like half an hour to get executed :
!conda install -c conda-forge geopy --yes
from geopy.geocoders import Nominatim # module to convert an address into latitude and longitude values
# libraries for displaying images
from IPython.display import Image
from IPython.core.display import HTML
# tranforming json file into a pandas dataframe library
from pandas.io.json import json_normalize
!conda install -c conda-forge folium=0.5.0 --yes
import folium # plotting library
What causes this ?
pip install folium
The root conda environment where you install the custom package must be very complex indeed (the price you pay for universal coverage to cater to needs of many users), and conda is particularly slow installer, as it makes a lot of I/O operations (even on NVMe drives it is so slow as you observe).
This is why Kaggle (and us) have switched to pip for all but a few of python packages, and so should you (if possible to find your package on PyPI - or at least on GitHub).
Try also to unpin the old version of the library you wanted to use (released nearly three years ago!) and use the latest one - much fewer packages will need to be reinstalled if you use the latest version:
So use:
pip install folium==0.11.0
or simply:
pip install folium

Checking version of cv2 in python 3.7

I have recently just installed cv2 for python 3.7 on a Mac os (Mojave). I have no problems importing it, but when I try to check the version with
cv2._version_
but I get
AttributeError: module 'cv2' has no attribute '_version'
can anyone help? thanks!
version needs to have double underscores (_)
To check version via python (installed through pip)
import cv2
print(cv2.__version__)
To check version for homebrew installs:
brew info opencv
or
brew info opencv3
(depending on how you installed it)

Trouble installing basemap on ipython

I've got IPython installed for both python3.3 and python3.4
When I tried to install basemap using conda install basemap I keep receving the two same errors saying there is a conflict.
Hint: the following combinations of packages create a conflict with the
remaining packages:
- python 3.3*
- basemap
Hint: the following combinations of packages create a conflict with the
remaining packages:
- python 3.4*
- basemap
Is basemap not supported by those two version of python? Do I need to move to python2.7 to get basemap to work? Or is there a different way to install basemap on ipython?
Thanks!
Basemap is available now for python 3.3 on windows, so this should no longer by an issue for you. I was having problems on python 3.5 and had to use pip to install the wheel file from here:
http://www.lfd.uci.edu/~gohlke/pythonlibs/
Worked with the basemap group to find a way to install it:
https://github.com/matplotlib/basemap/issues/249