Does Amp work with python3?
According to JJ's email regarding the latest ASE release, he wants to drop support for all python 2 versions (including 2.7). Does Amp work with python3? We should start testing this after v0.5 is done.
Comments (11)
-
-
I have started adding python3 compatibility. This needs the
future
package. I will keep changes tracked inpython3
branch.One of the examples is working:
Python3
muammar@zarathustra ~/quimica_pura/posgrado/Postdoc/brown/git/amp/tests [python3] ± % python3 test_gaussian_neural.py !10251 energy = 9.39500879866 forces = [[ -1.474488797687423524696015419977e-01 -8.959768403955417626072232906154e-02 1.657176074921125508154773342540e+00] [ 1.474488797687423247140259263688e-01 -8.959768403955417626072232906154e-02 1.657176074921125064065563492477e+00] [ -1.474488797687421581805722325953e-01 8.959768403955399584948082747360e-02 1.657176074921124842020958567446e+00] [ 1.474488797687420194026941544507e-01 8.959768403955389870496617277240e-02 1.657176074921124842020958567446e+00] [ -1.110223024625156540423631668091e-16 2.359223927328457648400217294693e-16 -1.725213968943962505875333590666e+00] [ 1.096631860891654161748301846221e-18 3.256151245630530940487070566012e-16 -1.605555498821993110070138754963e+00] [ -2.775557561562891351059079170227e-16 -6.938893903907228377647697925568e-17 -1.716565018981959900301603738626e+00] [ 1.653894285487269626649822014859e-16 -3.143094749873685686843755410968e-17 -7.201817769139543523593260943017e-01] [ 3.471790747254609760968273455800e-18 2.515349040166370286897290498018e-17 8.089237284688006734967302691075e-01] [ -3.438952793568430103039809870393e-22 -2.531478434088575640607240629278e-17 -1.670111764491431838308699298068e+00]] energy = 8.67677111386 forces = [[ 0.19229372034100092325736852672 -0.042672725094467650608365261178 1.103758070925668688389009730599] [-0.736895695212294810083619722718 -0.201031561670755698489898577463 0.338195816840282381665616640021] [ 0.110537295075784594566847829356 0.104420276210989274034979246153 1.318489892133295260379100000137] [-0.25234417524357399820189584716 0.135532432469323005364003620343 0.933545738751149101197768231941] [ 0.393563487886131824211588536855 -0.570296112631045182261857462436 -0.812409534856790016554839439777] [-0.210543678206015522080818413997 -0.182096556690753225149492777746 -1.191985314527358452707517244562] [ 0.711100850787217741988399666297 0.766648546505647399129657060257 -0.361988147109984281790673321666] [-0.213149776770818755178282799534 -0.011387080113856890006829303275 -0.681297866754282388512820034521] [-0.107422314122817441628399137699 0.039678950621204384097140405174 -1.668124940862589333789856027579] [ 0.11286028546538556804890163221 -0.038796169606285423048230853738 1.021816285460609874391479934275]] energy = 9.40089558467385 forces = [[ -1.267078018878353140586057179462e-01 -7.004551391790307668383519512645e-02 1.662412830211513536937673052307e+00] [ 1.267078018878354528364837960908e-01 -7.004551391790309056162300294091e-02 1.662412830211513536937673052307e+00] [ -1.267078018878353140586057179462e-01 7.004551391790270198356438413612e-02 1.662412830211513314893068127276e+00] [ 1.267078018878353418141813335751e-01 7.004551391790264647241315287829e-02 1.662412830211513314893068127276e+00] [ 5.551115123125782702118158340454e-17 4.475586568020162303582765161991e-16 -1.729860512303191155680792689964e+00] [ -4.264813282103921344438468758076e-17 4.547181441523334190907347271129e-16 -1.626614566557748497999114078993e+00] [ -2.775557561562891351059079170227e-17 9.367506770274758309824392199516e-17 -1.719777350624572154202951423940e+00] [ -2.276895176411739028575238586809e-16 1.146568163146018456781395323173e-16 -7.181315653264488396700926386984e-01] [ -8.636892465239386989792005157999e-18 2.927345865710861971820122562349e-17 8.061461106063444459479683246172e-01] [ -2.129337105515223524251798810862e-21 1.290888756008040060318049218733e-18 -1.661413436640436724900382614578e+00]] energy = 8.644408742201003 forces = [[ 0.153427002505904575002659839811 -0.051134346147631237755604161066 1.130028574392907492196513885574] [-0.664130031509397533717731221259 -0.202028309525818072778236000886 0.46581680551183834992912125017 ] [ 0.136961090085569781038543624163 0.033131455933642035838193606878 1.24295038959149906077072955668 ] [-0.198607151736233583649848810637 0.057858803852954270030561900739 1.033897413481540183965989854187] [ 0.25175280487651696681439261738 -0.44800191697401492429975178311 -0.874914170909117827612533346837] [-0.134072263935166136050725071982 -0.092611877312746088142247913311 -1.161792452740681325096261389263] [ 0.567196198576694121662455927435 0.643629715155326187492335066054 -0.475315035186545165046823058219] [-0.118256533962915300062235246514 0.056773929832059935596255684231 -0.817175871270310327787456117221] [-0.144451095416736841059446305735 0.05009173389512609764206985119 -1.966217792868691249807966414664] [ 0.15017998051576417206653957237 -0.047709188708898321584772617143 1.422722139997560031332568541984]]
Python2.7
muammar@zarathustra ~/quimica_pura/posgrado/Postdoc/brown/git/amp/tests [python3] ± % python2.7 test_gaussian_neural.py !10259 energy = 9.38897210333 forces = [[ -1.120374936485974415312227847608e-01 -6.240795574646229582072010089178e-02 1.658311915841731210008447305881e+00] [ 1.120374936485974276534349769463e-01 -6.240795574646225418735667744841e-02 1.658311915841730543874632530787e+00] [ -1.120374936485972749977690909873e-01 6.240795574646199050938832897373e-02 1.658311915841729433651607905631e+00] [ 1.120374936485972194866178597294e-01 6.240795574646193499823709771590e-02 1.658311915841730543874632530787e+00] [ -2.177268495130420452180400879253e-16 5.471362691432152453967243518586e-16 -1.734943166026649219446653660270e+00] [ 0.000000000000000000000000000000e+00 5.475373380038738640207938855434e-16 -1.598736632716494465711321026902e+00] [ -1.661389195081683204625484307397e-16 -1.544692577674808016894307342151e-16 -1.743670284135484305210184174939e+00] [ 1.658353243161611848598587505166e-16 -2.593841476569400106957895892615e-16 -7.381609749458123426180122805818e-01] [ -4.163336342344337026588618755341e-17 9.454176836298160405168171619645e-17 8.295676065150440203765924707113e-01] [ 2.904132766239095776611966617428e-23 -4.395719740585717419213447490321e-18 -1.647304212057525862888951451168e+00]] energy = 8.56043798112 forces = [[-0.14257100977137301955899317818 0.070220160135894743591578048836 1.086193613082971243244401193806] [ 0.931214529521221412444731413416 0.579240602875890520095936153666 0.27080822448165947635700945284 ] [-0.121367991660531637787556746844 -0.078066175431503459503090880389 1.068636849781690267846556707809] [ 0.158352389310189162197062273663 0.002772401829049304759766680917 1.347252639102925808600730306352] [-0.05252086743644523991747519176 -0.095466211291343236466921950978 -0.987408910243555149044425434113] [-0.807251086878637780230860698794 -0.627501906290185873515952152957 -0.199284258510225686933381439303] [ 0.045137884408214888620758387106 0.091698000302011806184054876212 -1.275253338192503083092788074282] [-0.016546023305642892919919972883 0.067498682407295756968679256715 -0.697607480920847455863054165093] [ 0.007513770005017668049407397746 -0.134362089607899304333216150553 -1.292292386241580270933582141879] [-0.00196159419201265890903007616 0.123966535070790292993869741167 0.67895504765946412817356758751 ]] energy = 9.38897210333 forces = [[ -1.120374936485974415312227847608e-01 -6.240795574646229582072010089178e-02 1.658311915841731210008447305881e+00] [ 1.120374936485974276534349769463e-01 -6.240795574646225418735667744841e-02 1.658311915841730543874632530787e+00] [ -1.120374936485972749977690909873e-01 6.240795574646199050938832897373e-02 1.658311915841729433651607905631e+00] [ 1.120374936485972194866178597294e-01 6.240795574646193499823709771590e-02 1.658311915841730543874632530787e+00] [ -2.177268495130420452180400879253e-16 5.471362691432152453967243518586e-16 -1.734943166026649219446653660270e+00] [ 0.000000000000000000000000000000e+00 5.475373380038738640207938855434e-16 -1.598736632716494465711321026902e+00] [ -1.661389195081683204625484307397e-16 -1.544692577674808016894307342151e-16 -1.743670284135484305210184174939e+00] [ 1.658353243161611848598587505166e-16 -2.593841476569400106957895892615e-16 -7.381609749458123426180122805818e-01] [ -4.163336342344337026588618755341e-17 9.454176836298160405168171619645e-17 8.295676065150440203765924707113e-01] [ 2.904132766239095776611966617428e-23 -4.395719740585717419213447490321e-18 -1.647304212057525862888951451168e+00]] energy = 8.56043798112 forces = [[-0.14257100977137301955899317818 0.070220160135894743591578048836 1.086193613082971243244401193806] [ 0.931214529521221412444731413416 0.579240602875890520095936153666 0.27080822448165947635700945284 ] [-0.121367991660531637787556746844 -0.078066175431503459503090880389 1.068636849781690267846556707809] [ 0.158352389310189162197062273663 0.002772401829049304759766680917 1.347252639102925808600730306352] [-0.05252086743644523991747519176 -0.095466211291343236466921950978 -0.987408910243555149044425434113] [-0.807251086878637780230860698794 -0.627501906290185873515952152957 -0.199284258510225686933381439303] [ 0.045137884408214888620758387106 0.091698000302011806184054876212 -1.275253338192503083092788074282] [-0.016546023305642892919919972883 0.067498682407295756968679256715 -0.697607480920847455863054165093] [ 0.007513770005017668049407397746 -0.134362089607899304333216150553 -1.292292386241580270933582141879] [-0.00196159419201265890903007616 0.123966535070790292993869741167 0.67895504765946412817356758751 ]]
-
I have a nearly working python 3/tensorflow-1 branched off of master at https://bitbucket.org/jkitchin/amp/branch/jkitchin
These tests are currently failing.
====================================================================== FAIL: numeric_analytic_test.test ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/jkitchin/anaconda3/lib/python3.5/site-packages/nose/case.py", line 198, in runTest self.test(*self.arg) File "/Users/jkitchin/vc/projects/neural-network/amp/tests/misc_test/numeric_analytic_test.py", line 103, in test 'wrong!' % (image_no + 1) AssertionError: The calculated value of energy of image 1 is wrong!
====================================================================== FAIL: train_test.periodic_0th_bfgs_step_test ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/jkitchin/anaconda3/lib/python3.5/site-packages/nose/case.py", line 198, in runTest self.test(*self.arg) File "/Users/jkitchin/vc/projects/neural-network/amp/tests/CuOPd_test/gaussian_neural_test/train_test.py", line 416, in periodic_0th_bfgs_step_test 'Calculated value of loss function is wrong!' AssertionError: Calculated value of loss function is wrong! -------------------- >> begin captured stdout << --------------------- train-periodic/False-1 diff at 414 = 0.00509043299462
====================================================================== FAIL: train_test.non_periodic_0th_bfgs_step_test ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/jkitchin/anaconda3/lib/python3.5/site-packages/nose/case.py", line 198, in runTest self.test(*self.arg) File "/Users/jkitchin/vc/projects/neural-network/amp/tests/CuOPd_test/gaussian_neural_test/train_test.py", line 206, in non_periodic_0th_bfgs_step_test 'Calculated value of loss function is wrong!' AssertionError: Calculated value of loss function is wrong! -------------------- >> begin captured stdout << --------------------- train-nonperiodic/False-1 diff at 204 = 0.00356458469651
====================================================================== ERROR: test_gaussian_tflow.train_test ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/jkitchin/anaconda3/lib/python3.5/site-packages/nose/case.py", line 198, in runTest self.test(*self.arg) File "/Users/jkitchin/vc/projects/neural-network/amp/tests/test_gaussian_tflow.py", line 55, in train_test calc.train(images=train_images,) File "/Users/jkitchin/vc/projects/neural-network/amp/amp/__init__.py", line 312, in train parallel=self._parallel) File "/Users/jkitchin/vc/projects/neural-network/amp/amp/model/tflow.py", line 928, in fit with open('tfAmpNN-checkpoint') as fhandle: FileNotFoundError: [Errno 2] No such file or directory: 'tfAmpNN-checkpoint'
I have had to modify a few tests to run on only one core. Otherwise it seems to hang on my Macbook Air. The two failing tests with the diffs also failed the same way with Python 2.7.
-
I have a nearly working python 3/tensorflow-1 branched off of master at https://bitbucket.org/jkitchin/amp/branch/jkitchin
Nice!. I won't work on porting that portion of the code then.
Regarding this error:
====================================================================== ERROR: test_gaussian_tflow.train_test ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/jkitchin/anaconda3/lib/python3.5/site-packages/nose/case.py", line 198, in runTest self.test(*self.arg) File "/Users/jkitchin/vc/projects/neural-network/amp/tests/test_gaussian_tflow.py", line 55, in train_test calc.train(images=train_images,) File "/Users/jkitchin/vc/projects/neural-network/amp/amp/__init__.py", line 312, in train parallel=self._parallel) File "/Users/jkitchin/vc/projects/neural-network/amp/amp/model/tflow.py", line 928, in fit with open('tfAmpNN-checkpoint') as fhandle: FileNotFoundError: [Errno 2] No such file or directory: 'tfAmpNN-checkpoint'
Which TensorFlow version are you using?. That module is only working with TensorFlow 0.11.0.
-
reporter I think tensorflow 1.0 came out at the same time as we were preparing Amp release 0.5. We should probably go ahead and make the development version depend on tf 1.0. Especially since this means that the interface is less likely to change drastically between versions now that they've hit 1.x.
-
I am using tensorflow '1.0.1'. It isn't obvious why it wouldn't work with other versions, is it just not tested with them or is there a known incompatibility?
Andy: another good reason is if you just pip install tensorflow, now you get version 1.
-
I am using tensorflow '1.0.1'. It isn't obvious why it wouldn't work with other versions, is it just not tested with them or is there a known incompatibility?
TensorFlow's devs even changed some function names, but I was checking the other day why the
checkpoint
wasn't created without success (everything seemed ok in the structure of Amp's module). Zachary (tflow's author) may know better how to make it works with 1.0.1. -
I guess it is because these files are created:
/tmp/amptests/tfAmpNN-checkpoint.data-00000-of-00001 /tmp/amptests/tfAmpNN-checkpoint.index
/tmp/amptests/tfAmpNN-checkpoint.metaIt looks like this is another place tensorflow changed the API.
@zachary_ulissi : Do you recall why there is checkpointing code in tflow.py? It looks like it just saves to disk and then immediately reads it in again to populate a variable called tfvars that is passed to constructSessGraphModel.
-
tests/CuOPd_test/gaussian_neural_test/train_test.py
is failing in Python 3. The script gets stuck presumably because of some communication channels not being handled correctly. However, amp0.6
is not affected by this. It seems that the problem starts from 81a38e7dd691171310f91fb3a16dc8da2730e44f.We are currently investigating in more details the source of the issue. This bug is a release blocker because our Debian package is python3 only.
-
reporter - changed status to resolved
Finally fix Issue
#143.This was a bug in ZMQ with python3. It needs to properly close all servers, which does not happen with object destruction in ZMQ under python3 for some reason.
→ <<cset ee6b52b04c65>>
-
Merge branch 'master' into krr_param
- master:
Pipeline updated to work with Python3.
Finally fix Issue
#143. tflow for python2/python3.
→ <<cset cdc40d7bfa17>>
- master:
Pipeline updated to work with Python3.
Finally fix Issue
- Log in to comment
I was working on that some weeks ago. There are some changes to make, but I can keep working on that direction. I believe it is a good idea to support both Python2 and Python3. I will report back when I am more advanced on that.