Using Theano and Lasagne with FIPS Enabled - theano

I have the following:
Python 2.7.5
RHEL 7.3 with FIPS enabled
Lasagne (0.2.dev1)
Theano (0.9.0)
I installed Theano and Lasange with pip without issue, but when I import lasange I receive an error related to FIPS:
$: python
Python 2.7.5 (default, Aug 2 2016, 04:20:16)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import lasagne
ERROR (theano.sandbox.cuda): Failed to compile cuda_ndarray.cu: error:060800A3:digital envelope routines:EVP_DigestInit_ex:disabled for fips
Is there some workaround known or available? Unfortunately I have to have FIPS enabled.
I'm just starting out with Theano and Lasagne so I apologize if I need additional help to troubleshoot.

As of now, it looks like md5 hashing is hardcoded into the library and has been acknowledged by Theano developers: https://github.com/Theano/Theano/issues/5757
Update: May 25, 2017
I have modified the theano code so it uses sha256 instead of md5. This has resolved the FIPS issues I've been experiencing and has not slowed down any computation I've been running.
You can review the pull request here: https://github.com/Theano/Theano/pull/5916
and you can download my changes here until it is merged: https://github.com/dareneiri/Theano , if indeed it is accepted.

Related

how to change tensorflow build version?

I am trying to build tensorflow from source following this link. Everything works good and I successfully build it based on master branch.
After I get the .whl package, I installed it and checked the version number. I get the following output:
Python 3.9.5 (default, Jun 18 2021, 13:37:06)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
>>> tf.__version__
'2.9.0'
>>>
I get the version number as '2.9.0'. it makes sense as I build based on master branch and the current release is 2.8.0. However, I wish to customize the version number, for example, as 2.9.0--xxx so that I know what features I added into this build. I thought there should be a setup file or something I can change but I cannot find it. Any ideas? Thx!

import xarray returns 'No protocol specified'

I have recently updated my xarray, but now am running into an error when I import it:
$ python3
Python 3.8.10 (default, Jun 2 2021, 10:49:15)
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>import xarray
No protocol specified
>>>
What does this mean? Does it have something to do with dependencies on something else? I upgraded using pip3. I do not own this computer, otherwise I would have installed everything with conda. Does pip3 also sort out dependency issues? I heard conda does.. and maybe I should switch over, but I don't want to create a conflict with the other users on the computer.
Maybe this information is also useful:
>>> import xarray
No protocol specified
>>> xarray.show_versions()
INSTALLED VERSIONS
------------------
commit: None
python: 3.8.10 (default, Jun 2 2021, 10:49:15)
[GCC 9.4.0]
python-bits: 64
OS: Linux
OS-release: 5.4.0-70-generic
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: ('en_US', 'UTF-8')
libhdf5: 1.10.4
libnetcdf: 4.7.3
xarray: 0.19.0
pandas: 1.3.2
numpy: 1.17.4
scipy: 1.3.3
netCDF4: 1.5.3
pydap: None
h5netcdf: 0.7.1
h5py: 2.10.0
Nio: None
zarr: 2.4.0+ds
cftime: 1.1.0
nc_time_axis: None
PseudoNetCDF: None
rasterio: None
cfgrib: None
iris: None
bottleneck: 1.2.1
dask: 2.8.1+dfsg
distributed: None
matplotlib: 3.1.2
cartopy: 0.18.0
seaborn: None
numbagg: None
pint: None
setuptools: 45.2.0
pip: 20.0.2
conda: None
pytest: 4.6.9
IPython: 7.13.0
sphinx: 1.8.5
>>>
This error reflects a problem with how your computer's display is configured, not an error with Xarray.
This answer seems to address the No protocol specified message directly.

PyOpenCL 2020.1 - Device side queue is unimplemented

I am facing an issue with pyopencl I never had before (see piece of code below)
the issue : Device side queue is unimplemented (clCreateCommandQueueWithProperties.c:93)
Have any of you faced this problem before ?
Do you have any idea wher it comes from ?
thanks in advance !
user#debian_9.5:~# pip3 freeze | grep pyopencl
pyopencl==2020.1
user#debian_9.5:~# python3
Python 3.5.3 (default, Sep 27 2018, 17:25:39)
[GCC 6.3.0 20170516] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyopencl as cl
>>> ctx = cl.create_some_context()
Choose platform:
[0] <pyopencl.Platform 'Portable Computing Language' at 0x7fb1fbfba020>
Choice [0]:0
Set the environment variable PYOPENCL_CTX='0' to avoid being asked again.
>>> print(ctx)
<pyopencl.Context at 0x55c1e9a87440 on <pyopencl.Device 'pthread-AMD Ryzen Threadripper 1950X 16-Core Processor' on 'Portable Computing Language' at 0x55c1ea017430>>
>>> queue = cl.CommandQueue(ctx)
Device side queue is unimplemented (clCreateCommandQueueWithProperties.c:93)
my setup is as folow : AMD-ryzen_1950X - debian_9.5 - python_3.5.3
solved doing :
user#debian_9.5:~# pip uninstall pyopencl && apt install python3-pyopencl

install wxpython for python2 and 3 on ubuntu

I am running Ubuntu 16 and have both python 2 and 3. I have downloaded wxpython and it works with the python2 interpreter but not 3. I get
Python 2.7.12 (default, Nov 19 2016, 06:48:10)
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import wx
>>>
and
Python 3.5.2 (default, Sep 14 2017, 22:51:06)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import wx
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'wx'
What do I need to do to get installed for python 3?
A similar situation arises on Fedora 25, on which I was able to solve this. Your mileage may vary on Ubuntu.
First note that wxPython is available in two major versions, let's call them wx3 and wx4. You can identify your running version through import wx; print(wx.version()). The version string on Fedora 25 reads '3.0.2.0 gtk3 (classic)', i.e. a brand of wx3. On sourceforge these versions are known as 'wxPython' and 'wxPython4', and wxpython.org calls wx4 'phoenix'.
Inspecting the source code of wx3 you will note that wx3's syntax is incompatible with python3. Conversely, wx4 is compatible both with python2.7 and python3.
wx4 doesn't seem to be available on Fedora 25, therefore python3 can't run any wx out-of-the-box. Ubuntu may or may not have the same issue.
The following worked for me to install wx4 in a python3 virtual environment:
pip install -U -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/fedora-26 wxPython
I presume the answer to your question would be
pip install -U -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-16.04 wxPython
In case you need to port a (py2, wx3) application to python3, you would be wise creating an intermediate step: (py2, wx3) -> (py2, wx4) -> (py3, wx4), noting that (py3, wx3) is an impossibility.
To create the (py2, wx4) environment was more cumbersome for me, because the above pip install command fails to find header files when run using pip2.
What ended up working for me was to download the 4.0.0b2 source https://pypi.python.org/packages/bc/6f/f7bb525517557e1c596bf22ef3f242b87afaeab57c9ad460cb94b3b0714e/wxPython-4.0.0b2.tar.gz#md5=2e3716205da8f52d8039095d14534bf7
and follow the build instructions https://github.com/wxWidgets/Phoenix/blob/master/README.rst , from which I only used the build command python build.py dox etg --nodoc sip build .
After building, you need to tell your python2 where to find the wx4 library. I ended up doing that by creating a virtualenv, and creating a symbolic link like so:
/home/user/venv/lib/python2.7/site-packages/wx -> /home/user/downloads/wxPython/wxPython-4.0.0b2/wx
That latter directory cointaining the result of the build.

Use graphviz with python3

I try to draw a decision tree using the graphviz module, and it works fine with python2. Is there a way to use this module with python3?
Is there any other module that supports drawing decision trees in python3?
Did you install graphviz for python3? It works fine for me:
andi#sunnyside:~$ python3
Python 3.5.3 (default, Jan 19 2017, 14:11:04)
[GCC 6.3.0 20170118] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import graphviz
>>>
I am using debian though and there is no debian package for graphviz itself, you have to install it with pip3.

Resources