Ask Your Question

posita's profile - activity

2020-08-19 11:08:50 +0200 received badge  Famous Question (source)
2020-08-19 11:08:50 +0200 received badge  Notable Question (source)
2020-08-19 11:08:50 +0200 received badge  Popular Question (source)
2020-08-18 20:46:20 +0200 received badge  Supporter (source)
2020-08-18 20:46:04 +0200 answered a question Cannot use pip because pip is configured with locations that require TLS/SSL

UPDATE: I totally missed the answer above pointing to https://ask.sagemath.org/question/511... . Perhaps this should be closed as a dup?


This still happens for me, even in 9.1 (on OS X installed via downloaded .dmg). In my case:

% ( set -ex ; cd ~/Applications/SageMath.app/Contents/Resources/sage ; ./local/bin/sage -pip install py-heat-magic )
+-zsh:21> cd /Users/…/Applications/SageMath.app/Contents/Resources/sage
+-zsh:21> ./local/bin/sage -pip install py-heat-magic
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Collecting py-heat-magic
  Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/py-heat-magic/
  Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/py-heat-magic/
  Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/py-heat-magic/
  Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/py-heat-magic/
  Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/py-heat-magic/
  Could not fetch URL https://pypi.org/simple/py-heat-magic/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/py-heat-magic/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping
  Could not find a version that satisfies the requirement py-heat-magic (from versions: )
No matching distribution found for py-heat-magic
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping
2015-01-28 13:08:11 +0200 received badge  Nice Question (source)
2015-01-27 21:36:46 +0200 received badge  Student (source)
2015-01-27 20:33:07 +0200 received badge  Editor (source)
2015-01-27 20:32:24 +0200 asked a question density_plot + def'ed python function = TypeError?

I have the following functions:

var('a, b')

# This will work with both contour_plot and density_plot
f1(a, b) = 1 - b / a

# So will this
f2(a, b) = 1 - a / b

# This only works with contour_plot?!
def f12(a, b):
    if a - b < 0:
        return f1(a, b)
    else:
        return f2(a, b)

Obviously, f1 and f2 are symbolic functions, where f12 is a def'ed python function. Calling contour_plot works on all three. Calling density_plot works on f1 and f2, but raises a TypeError when called with f12, the def'ed python function.

I've created a project that has an interactive session demonstrating the problem.

Here's the trace:

Error in lines 1-1
Traceback (most recent call last):
  ...
  File "/projects/443a2a33-d145-4b63-893f-175543cc50c6/.sagemathcloud/sage_salvus.py", line 2306, in show
    show_2d_plot_using_matplotlib(obj, svg=svg, **kwds)
  File "/projects/443a2a33-d145-4b63-893f-175543cc50c6/.sagemathcloud/sage_salvus.py", line 2229, in show_2d_plot_using_matplotlib
    obj.save(t, **kwds)
  File "/usr/local/sage/sage-6.4/local/lib/python2.7/site-packages/sage/misc/decorators.py", line 471, in wrapper
    return func(*args, **kwds)
  File "/usr/local/sage/sage-6.4/local/lib/python2.7/site-packages/sage/plot/graphics.py", line 2972, in save
    figure = self.matplotlib(**options)
  File "/usr/local/sage/sage-6.4/local/lib/python2.7/site-packages/sage/plot/graphics.py", line 2418, in matplotlib
    g._render_on_subplot(subplot)
  File "/usr/local/sage/sage-6.4/local/lib/python2.7/site-packages/sage/plot/density_plot.py", line 146, in _render_on_subplot
    subplot.imshow(self.xy_data_array, origin='lower', cmap=cmap, extent=(x0,x1,y0,y1),  interpolation=options['interpolation'])
  File "/usr/local/sage/sage-6.4/local/lib/python2.7/site-packages/matplotlib-1.3.1-py2.7-linux-x86_64.egg/matplotlib/axes.py", line 7300, in imshow
    im.set_data(X)
  File "/usr/local/sage/sage-6.4/local/lib/python2.7/site-packages/matplotlib-1.3.1-py2.7-linux-x86_64.egg/matplotlib/image.py", line 425, in set_data
    raise TypeError("Image data can not convert to float")
TypeError: Image data can not convert to float

Am I asking density_plot to do something crazy here? If not, what am I doing wrong?