Git Product home page Git Product logo

Comments (10)

demisjohn avatar demisjohn commented on August 23, 2024 1

Stuff To fix:

camfr/camfr_wrap.cpp:580:3: error: void function 'init_module__camfr' should not return a
      value [-Wreturn-type]
  import_array();
  ^~~~~~~~~~~~~~
/opt/local/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/numpy/core/include/numpy/__multiarray_api.h:1547:144: note: 
      expanded from macro 'import_array'
  ..."numpy.core.multiarray failed to import"); return NUMPY_IMPORT_ARRAY_RETVAL; } }
                                                ^      ~~~~~~~~~~~~~~~~~~~~~~~~~

See these links for fixes:
pandas-dev/pandas#3872
tensorflow/tensorflow#733
Googled : https://www.google.com/search?client=safari&rls=en&q=%22should+not+return+a+value%22+return+NUMPY_IMPORT_ARRAY_RETVAL&ie=UTF-8&oe=UTF-8

from camfr.

demisjohn avatar demisjohn commented on August 23, 2024

Trying this on this branch: https://github.com/demisjohn/CAMFR/tree/py35_compat

from camfr.

demisjohn avatar demisjohn commented on August 23, 2024

After fixing "TabErrors", compiling (and failing due to above numpy issue), ahve a bunch of indentation errors!
Numerous def and if statements are now incorrectly indented.
Some of those might only pop errors when the functions are executed during usage, not during compilation...

byte-compiling visualisation/camfr_PIL.py to camfr_PIL.cpython-35.pyc
Sorry: IndentationError: expected an indented block (camfr_PIL.py, line 672)
byte-compiling visualisation/camfr_matlab.py to camfr_matlab.cpython-35.pyc
Sorry: IndentationError: expected an indented block (camfr_matlab.py, line 203)
byte-compiling visualisation/camfr_tk.py to camfr_tk.cpython-35.pyc
Sorry: IndentationError: expected an indented block (camfr_tk.py, line 312)
byte-compiling visualisation/TkPlotCanvas.py to TkPlotCanvas.cpython-35.pyc
Sorry: IndentationError: expected an indented block (TkPlotCanvas.py, line 187)

Looks like the original files will randomly switch between using Tabs and four-spaces, even within a single function. Sounds like Py27 graciously glossed this over, but this is now an error in py3.x

from camfr.

demisjohn avatar demisjohn commented on August 23, 2024

@demisjohn: Run 'diff' on py35 and py27 source files, look for indentation mistakes (I may have introduced some)

Do the diff in GitHub:
https://stackoverflow.com/questions/43552274/how-can-i-diff-two-branches-in-github

Here's the diff link:
master...demisjohn:py35_compat

from camfr.

demisjohn avatar demisjohn commented on August 23, 2024

Corrected indentations to match old master version, in 7e1224c

Some of the loops and function defs had been incorrectly indented, hopefully they are fixed. Have NOT yet run tests to confirm they're all ok.

from camfr.

demisjohn avatar demisjohn commented on August 23, 2024

Regarding numpy error, it seems that, new in Python3, numpy's C library returns an int whereas it used to return void. This is supposedly ocurring in the camfrwrap.cpp file, where it creates some sort of wrapper/pointer to the numpy C code (?). Some suggestions were to add a conditional into the wrap.cpp file that defines our func as void/int depending on whether it's being compiled for py2x/py3x.
I suppose it would be good for the library to be cross-compatible with python2/3, but I am heavily leaning towards just dropping support for 2.x entirely.

Let me know if there's some pressing reason we should still support python 2.x.

from camfr.

kitchenknif avatar kitchenknif commented on August 23, 2024

Don't see any real reason on maintaining Python 2.x support.

Maybe do a final 2.x-compatible release, and then drop 2.x?

from camfr.

demisjohn avatar demisjohn commented on August 23, 2024

Online articles indicate that one should really just move to Python3.x, so i will try to do that.

from camfr.

demisjohn avatar demisjohn commented on August 23, 2024

Good idea @kitchenknif , I'll make a "release" for py2.x and call it done. May keep py2.7 alive for a short while longer as I try to get actual work done with CAMFR before the py3.x version is actually working.

from camfr.

jsenellart avatar jsenellart commented on August 23, 2024

just to keep track on this issue about the last changes for CAMFR users:

  • the patches here: #21 now integrated in the branch are fixing the remaining python issues and configuration issues - and tested on MBP M1 macOS with Python 3.9
  • the patches here: #22 to be integrated in the branch are fixing pre-existing issues in C code - mainly related to boundary checking in different algorithms, and fix use of numpy deprecated functions

one single test unit is not passing:

======================================================================
FAIL: testbackward (__main__.backward)
backward
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/senellart/DEV/3rdParty/CAMFR/testsuite/backward.py", line 48, in testbackward
    self.assertTrue(R_pass and T_pass)
AssertionError: False is not true

----------------------------------------------------------------------

I will complete with additional cleanup on setup.py - on from if the last test unit passes, from my perspective, this branch will be fully functional.

from camfr.

Related Issues (19)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.