how to change tensorflow build version? - python-3.x

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!

Related

python 3 on Debian working in interactive mode but can't run any command

I successfully installed Python 3.7 on a Debian machine (GCE) and it runs correctly in interactive mode.
$python3
Python 3.7.4 (default, May 16 2020, 07:48:36)
[GCC 6.3.0 20170516] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
But when I try to perform any command I receive follow:
$ python3 ––version
python3: can't open file '––version': [Errno 2] No such file or directory
It looks like you accidentally used en dash – instead of hyphen -. Parameters should start with hyphen.
Try:
python3 --version
Instead of:
python3 ––version

Unable to import Pandas in IPython 6.5.0 console (Spyder)

After installing pandas am able to import in cmd as below :
C:\Users\me\Desktop\Django_Project>python
Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit
(AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pandas
>>>
But when am importing pandas in Spyder in IPython 6.5.0 console I get below error:
Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:06:47) [MSC v.1914 32 bit (Intel)]
Type "copyright", "credits" or "license" for more information.
IPython 6.5.0 -- An enhanced Interactive Python.
c:\program files (x86)\python37-32\lib\site-packages\ipykernel\parentpoller.py:116: UserWarning: Parent poll failed. If the frontend dies,
the kernel may be left running. Please let us know
about your system (bitness, Python, etc.) at
ipython-dev#scipy.org
ipython-dev#scipy.org""")
In [1] : import pandas
Traceback (most recent call last):
File "<ipython-input-1-38d4b0363d82>", line 1, in <module>
import pandas
ModuleNotFoundError: No module named 'pandas'
In [2] :
Note: I have installed python in "C:\Users\me\AppData\Local\Programs\Python\Python37\" path and environment variables is set as "C:\Users\me\AppData\Local\Programs\Python\Python37;"
And I installed pandas using PIP
Please suggest the solution to resolve this issue.I have tried reinstalling the pandas package almost 6-7 times.
I think you should open anaconda command prompt by searching it in windows search bar . Now write there "conda install -c anaconda pandas" and try again to run the program

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.

Using Theano and Lasagne with FIPS Enabled

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.

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