POLYMER 4.16.1 make error

lanzhiqishi
Posts: 44
Joined: Fri May 22, 2020 7:00 pm
company / institution: university of maine
Location: maine

POLYMER 4.16.1 make error

Post by lanzhiqishi »

Dear sir,


When i try install POLYMER4.16.1 on linux centos7 with anaconda, the 'make' step is error, detail is below. thank you



Best

Binbin





polymer) [sc73004@ln32%bscc-a2 polymer-v4.16.1]$ make
python setup.py build_ext --inplace
Compiling polymer/clut.pyx because it changed.
Compiling polymer/neldermead.pyx because it changed.
Compiling polymer/polymer_main.pyx because it changed.
Compiling polymer/water.pyx because it changed.
[1/4] Cythonizing polymer/clut.pyx
/public3/home/sc73004/.conda/envs/polymer/lib/python3.11/site-packages/Cython/Compiler/Main.py:381: FutureWarning: Cython directive 'language_level' not set, using '3str' for now (Py3). This has changed from earlier releases! File: /public3/home/sc73004/software-sc73004/polymer-v4.16.1.tar/polymer-v4.16.1/polymer-v4.16.1/polymer/clut.pxd
tree = Parsing.p_module(s, pxd, full_module_name)

Error compiling Cython file:
------------------------------------------------------------
...
cdef CLUT A = CLUT(np.array([[1, 2, 3], [4, 5, 6]]), axes=[[1, 2], [10, 11, 12]])

assert A.lookup(0, 1.5) == 0
assert A.lookup(1, 11.5) == 0

print A.interp()
^
------------------------------------------------------------

polymer/clut.pyx:293:10: Syntax error in simple statement list
Traceback (most recent call last):
File "/public3/home/sc73004/software-sc73004/polymer-v4.16.1.tar/polymer-v4.16.1/polymer-v4.16.1/setup.py", line 26, in <module>
EXTENSIONS = cythonize([SRC_DIR + '/*.pyx'],
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/public3/home/sc73004/.conda/envs/polymer/lib/python3.11/site-packages/Cython/Build/Dependencies.py", line 1134, in cythonize
cythonize_one(*args)
File "/public3/home/sc73004/.conda/envs/polymer/lib/python3.11/site-packages/Cython/Build/Dependencies.py", line 1301, in cythonize_one
raise CompileError(None, pyx_file)
Cython.Compiler.Errors.CompileError: polymer/clut.pyx
make: *** [main] Error 1
sakvaka_env
Posts: 25
Joined: Mon Mar 07, 2022 9:54 am
company / institution: Finnish Environment Institute
Location: Helsinki, Finland

Re: POLYMER 4.16.1 make error

Post by sakvaka_env »

The error is stated in the message: "FutureWarning: Cython directive 'language_level' not set, using '3str' for now (Py3). This has changed from earlier releases!" Polymer's compiled Python/C module is written in Python 2.

The change occurred on July 17 2023 when Cython v. 3.0.0 was released.
lanzhiqishi
Posts: 44
Joined: Fri May 22, 2020 7:00 pm
company / institution: university of maine
Location: maine

Re: POLYMER 4.16.1 make error

Post by lanzhiqishi »

Dear sakvaka_env,

Thank you for your so details explain.
Is that mean i should use the old version with Cpython, maybe Cpython 2.0 will be work.


Best

Binbin
sakvaka_env
Posts: 25
Joined: Mon Mar 07, 2022 9:54 am
company / institution: Finnish Environment Institute
Location: Helsinki, Finland

Re: POLYMER 4.16.1 make error

Post by sakvaka_env »

lanzhiqishi wrote:
Fri Jul 28, 2023 12:06 pm
Dear sakvaka_env,

Thank you for your so details explain.
Is that mean i should use the old version with Cpython, maybe Cpython 2.0 will be work.


Best

Binbin
That's one option, but another is to modify setup.py like this to force Cython to use Python 2:

Code: Select all

--- setup.py	2023-04-07 11:58:22.000000000 +0000
+++ setup.py.old	2023-07-28 08:29:53.349969369 +0000
@@ -14,6 +14,7 @@
     compiler_directives = {
             'profile': True,
             'embedsignature': True,
+            'language_level': "2"
             }
 else:
     compiler_directives = {
@@ -21,6 +22,7 @@
             'initializedcheck': False,
             'cdivision': True,
             'embedsignature': True,
+            'language_level': "2"
             }
 
 EXTENSIONS = cythonize([SRC_DIR + '/*.pyx'],
lanzhiqishi
Posts: 44
Joined: Fri May 22, 2020 7:00 pm
company / institution: university of maine
Location: maine

Re: POLYMER 4.16.1 make error

Post by lanzhiqishi »

Dear sakvaka_env,

thank you. I just follow your steps. Now it looks work, is that right?


Best, Binbin



(polymer) [sc73004@ln31%bscc-a2 polymer-v4.16.1]$ make
python setup.py build_ext --inplace
Compiling polymer/clut.pyx because it changed.
Compiling polymer/neldermead.pyx because it changed.
Compiling polymer/polymer_main.pyx because it changed.
Compiling polymer/water.pyx because it changed.
[1/4] Cythonizing polymer/clut.pyx
[2/4] Cythonizing polymer/neldermead.pyx
[3/4] Cythonizing polymer/polymer_main.pyx
[4/4] Cythonizing polymer/water.pyx
In file included from /public3/home/sc73004/.conda/envs/polymer/lib/python3.11/site-packages/numpy/core/include/numpy/ndarraytypes.h:1929:0,
from /public3/home/sc73004/.conda/envs/polymer/lib/python3.11/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,
from /public3/home/sc73004/.conda/envs/polymer/lib/python3.11/site-packages/numpy/core/include/numpy/arrayobject.h:5,
from build/polymer/clut.c:1097:
/public3/home/sc73004/.conda/envs/polymer/lib/python3.11/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning "Using deprecated NumPy API, disable it with " "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
#warning "Using deprecated NumPy API, disable it with " \
^
In file included from /public3/home/sc73004/.conda/envs/polymer/lib/python3.11/site-packages/numpy/core/include/numpy/ndarraytypes.h:1929:0,
from /public3/home/sc73004/.conda/envs/polymer/lib/python3.11/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,
from /public3/home/sc73004/.conda/envs/polymer/lib/python3.11/site-packages/numpy/core/include/numpy/arrayobject.h:5,
from build/polymer/neldermead.c:1097:
/public3/home/sc73004/.conda/envs/polymer/lib/python3.11/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning "Using deprecated NumPy API, disable it with " "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
#warning "Using deprecated NumPy API, disable it with " \
^
In file included from /public3/home/sc73004/.conda/envs/polymer/lib/python3.11/site-packages/numpy/core/include/numpy/ndarraytypes.h:1929:0,
from /public3/home/sc73004/.conda/envs/polymer/lib/python3.11/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,
from /public3/home/sc73004/.conda/envs/polymer/lib/python3.11/site-packages/numpy/core/include/numpy/arrayobject.h:5,
from build/polymer/polymer_main.c:1097:
/public3/home/sc73004/.conda/envs/polymer/lib/python3.11/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning "Using deprecated NumPy API, disable it with " "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
#warning "Using deprecated NumPy API, disable it with " \
^
build/polymer/polymer_main.c: In function ‘__pyx_f_7polymer_12polymer_main_16PolymerMinimizer_loop’:
build/polymer/polymer_main.c:27484:16: warning: ‘__pyx_v_i_fguess’ may be used uninitialized in this function [-Wmaybe-uninitialized]
Py_ssize_t __pyx_tmp_idx = __pyx_v_i_fguess;
^
In file included from /public3/home/sc73004/.conda/envs/polymer/lib/python3.11/site-packages/numpy/core/include/numpy/ndarraytypes.h:1929:0,
from /public3/home/sc73004/.conda/envs/polymer/lib/python3.11/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,
from /public3/home/sc73004/.conda/envs/polymer/lib/python3.11/site-packages/numpy/core/include/numpy/arrayobject.h:5,
from build/polymer/water.c:1102:
/public3/home/sc73004/.conda/envs/polymer/lib/python3.11/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning "Using deprecated NumPy API, disable it with " "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
#warning "Using deprecated NumPy API, disable it with " \
^
In file included from build/polymer/water.c:1108:0:
build/polymer/fresnel.c: In function ‘windex’:
build/polymer/fresnel.c:34:5: warning: ‘index’ may be used uninitialized in this function [-Wmaybe-uninitialized]
return(index);
^
lanzhiqishi
Posts: 44
Joined: Fri May 22, 2020 7:00 pm
company / institution: university of maine
Location: maine

Re: POLYMER 4.16.1 make error

Post by lanzhiqishi »

Dear sakvaka_env,


when i try polymer4.16 for sentinel-2 , it errors. I am not sure that the install error or anythings else, the error below.


Best, Binbin






(polymer) [sc73004@ln31%bscc-a2 polymer-v4.16.1]$ python sentinelbatchrun_2018Machias.py
Traceback (most recent call last):
File "sentinelbatchrun_2018Machias.py", line 1, in <module>
from polymer.main import run_atm_corr
File "/public3/home/sc73004/software-sc73004/polymer-v4.16.1.tar/polymer-v4.16.1/polymer-v4.16.1/polymer/main.py", line 16, in <module>
from polymer.polymer_main import PolymerMinimizer
ModuleNotFoundError: No module named 'polymer.polymer_main'
tsilva
Posts: 7
Joined: Tue Nov 02, 2021 5:32 pm
company / institution: CEFAS, UK government
Location: Lowestoft

Re: POLYMER 4.16.1 make error

Post by tsilva »

I think that the best solution for now is to edit the environment.yml file to make this incompatibility explicit:

- cython<3

It would also help to have the restriction on python<3.9 revised as this will become increasingly restrictive to solve dependencies.

Tiago
sakvaka_env
Posts: 25
Joined: Mon Mar 07, 2022 9:54 am
company / institution: Finnish Environment Institute
Location: Helsinki, Finland

Re: POLYMER 4.16.1 make error

Post by sakvaka_env »

lanzhiqishi wrote:
Tue Aug 08, 2023 2:43 am
In file included from /public3/home/sc73004/.conda/envs/polymer/lib/python3.11/site-packages/numpy/core/include/numpy/ndarraytypes.h:1929:0,
from /public3/home/sc73004/.conda/envs/polymer/lib/python3.11/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,
from /public3/home/sc73004/.conda/envs/polymer/lib/python3.11/site-packages/numpy/core/include/numpy/arrayobject.h:5,
from build/polymer/water.c:1102:
/public3/home/sc73004/.conda/envs/polymer/lib/python3.11/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning "Using deprecated NumPy API, disable it with " "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
#warning "Using deprecated NumPy API, disable it with " \
^
In file included from build/polymer/water.c:1108:0:
build/polymer/fresnel.c: In function ‘windex’:
build/polymer/fresnel.c:34:5: warning: ‘index’ may be used uninitialized in this function [-Wmaybe-uninitialized]
return(index);
^
These are just warnings and they don't affect Polymer's operations.

lanzhiqishi wrote:
Tue Aug 08, 2023 8:34 am
(polymer) [sc73004@ln31%bscc-a2 polymer-v4.16.1]$ python sentinelbatchrun_2018Machias.py
Traceback (most recent call last):
File "sentinelbatchrun_2018Machias.py", line 1, in <module>
from polymer.main import run_atm_corr
File "/public3/home/sc73004/software-sc73004/polymer-v4.16.1.tar/polymer-v4.16.1/polymer-v4.16.1/polymer/main.py", line 16, in <module>
from polymer.polymer_main import PolymerMinimizer
ModuleNotFoundError: No module named 'polymer.polymer_main'
This is no more related to the original question, but looks like an install error and something you need to resolve there.
lanzhiqishi
Posts: 44
Joined: Fri May 22, 2020 7:00 pm
company / institution: university of maine
Location: maine

Re: POLYMER 4.16.1 make error

Post by lanzhiqishi »

Dear all

I just refer to rafael.simao's suggestion. you could see below, after do command line 'make' again. it works


Best

Binbin


rafael.simao's suggestion:

Hello, I recently installed v4.16.1 and was trying to run polymer_cli.py but got an error about importing Level1 and Level2 from polymer.main
This can be solved this by adding two lines in the polymer/main.py script:

from polymer.level1 import Level1
from polymer.level2 import Level2
saikiranpennam
Posts: 1
Joined: Thu Aug 10, 2023 6:41 pm
company / institution: Colorado State University
Location: Fort Collins

Re: POLYMER 4.16.1 make error

Post by saikiranpennam »

python setup.py build_ext --inplace

made the Python changes as intersected earlier in this post, as per the instructions from the Enpt documentation, I don't have a folder called 'auxdata_common', just 'auxdata'

How do I proceed after this?
Post Reply