Code Monkey home page Code Monkey logo

Comments (16)

Zheng321 avatar Zheng321 commented on August 18, 2024

Update:

I note homebrew_path = os.path.join('usr', 'local', 'opt', 'cutest', 'lib', 'libcutest.a') gives usr/local/opt/cutest/lib/libcutest.a, which is not a file. It miss a \ at the beginning. I try to fix this by updating the codes to homebrew_path = os.path.join('\usr', 'local', 'opt', 'cutest', 'lib', 'libcutest.a') in system_paths.py. I did this to all get_path functions for cutest, sifdecode, etc.. and is able to import pycutest.

When I try to read problem by pycutest.import_problem('TAME'), sifdecode errors indicating environment variables not set jump out. Thus, I try to include the following codes to add environment variables.

os.environ['ARCHDEFS'] = '/usr/local/opt/archdefs/libexec'
os.environ['SIFDECODE'] = '/usr/local/opt/sifdecode/libexec'
os.environ['MYARCH'] = 'mac64.osx.gfo'
os.environ['MASTSIF'] = '/usr/local/opt/mastsif/share/mastsif'
os.environ['CUTEST'] = '/usr/local/opt/cutest/libexec'

The environment variable error is gone, but the newest issue is the following:

AttributeError                            Traceback (most recent call last)
Input In [5], in <cell line: 1>()
----> 1 pycutest.import_problem('TAME')

File ~/opt/miniconda3/envs/env3.10/lib/python3.10/site-packages/pycutest/build_interface.py:348, in import_problem(problemName, destination, sifParams, sifOptions, efirst, lfirst, nvfirst, quiet, drop_fixed_variables)
    346 # Import the module CACHE_SUBFOLDER.problemDir, and return a wrapper
    347 try:
--> 348     return CUTEstProblem(__import__('%s.%s' % (CACHE_SUBFOLDER, problemDir), globals(), locals(), [str(problemDir)]),
    349                          drop_fixed_variables=drop_fixed_variables)
    350 except ImportError as error:
    351     try: # check if cache folder is on python path

File ~/opt/miniconda3/envs/env3.10/lib/python3.10/site-packages/pycutest/problem_class.py:82, in CUTEstProblem.__init__(self, module, drop_fixed_variables)
     78 self.drop_fixed_vars = drop_fixed_variables
     80 # Extract useful problem info
---> 82 self.name = self._module.info['name']
     83 """ CUTEst problem name (string) """
     85 self.n = self._module.info['n']

AttributeError: module 'pycutest_cache_holder.TAME' has no attribute 'info'

I don't feel I'm on the right way to go, any help please? I follow the installation for mac exactly, and redo it several times. I really don't know where I did wrong. Thank you so much for the help!

from pycutest.

jfowkes avatar jfowkes commented on August 18, 2024

Hi there, sorry to hear that you're having issues on mac, it really shouldn't be this difficult!

It looks from your logs there is a problem with the homebrew CUTEst install. If you look at the homebrew installer here:
https://github.com/optimizers/homebrew-cutest
it sets up all the CUTEst environment variables and copies them into your ~/.bashrc on the last line:

brew tap optimizers/cutest
brew install cutest
brew install mastsif  # If you want the whole SIF collection.
for f in "archdefs" "mastsif" "sifdecode" "cutest"; do \
  echo ". $(brew --prefix $f)/$f.bashrc" >> ~/.bashrc; \
done

These should then be picked up by PyCUTEst, if that's not the case then you can source them manually as follows:

source /usr/local/opt/archdefs/archdefs.bashrc
source /usr/local/opt/sifdecode/sifdecode.bashrc
export MASTSIF=/usr/local/opt/mastsif/
source /usr/local/opt/cutest/cutest.bashrc

which is what we do in our macOS CI tests. Could you clear out your PyCUTEst cache and try again with the above environment variables?

from pycutest.

Zheng321 avatar Zheng321 commented on August 18, 2024

Thank you for your help @jfowkes ! I tried the following comments:

brew uninstall cutest
brew uninstall sifdecode
brew uninstall mastsif
pip uninstall pycutest

Then I start from very beginning:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew tap optimizers/cutest
brew install cutest --without-single
brew install mastsif
brew install sifdecode

At this point, I checked if there were installed successfully, by

brew test cutest
brew test mastsif
brew test sifdecode

They all pass without reporting any error message.

Then, I move on to

for f in "archdefs" "mastsif" "sifdecode" "cutest"; do \
  echo ". $(brew --prefix $f)/$f.bashrc" >> ~/.bashrc; \
done

I check the current bashrc file by

vim ~/.bashrc

It gives

. /usr/local/opt/archdefs/archdefs.bashrc
. /usr/local/opt/mastsif/mastsif.bashrc
. /usr/local/opt/sifdecode/sifdecode.bashrc
. /usr/local/opt/cutest/cutest.bashrc
. /usr/local/opt/archdefs/archdefs.bashrc
. /usr/local/opt/mastsif/mastsif.bashrc
. /usr/local/opt/sifdecode/sifdecode.bashrc
. /usr/local/opt/cutest/cutest.bashrc

(repeat twice maybe bc I run this command before) Then I activate my python env and install pycutest

conda activate env3.10
pip install pycutest

Lastly I run python codes:

import pycutest

It reports error:

RuntimeError                              Traceback (most recent call last)
Input In [1], in <cell line: 1>()
----> 1 import pycutest
      2 import os

File ~/opt/miniconda3/envs/env3.10/lib/python3.10/site-packages/pycutest/__init__.py:9, in <module>
      6 from .version import __version__
      7 __all__ += ['__version__']
----> 9 from .build_interface import import_problem, clear_cache, all_cached_problems
     10 __all__ += ['import_problem', 'clear_cache', 'all_cached_problems']
     12 from .sifdecode_extras import print_available_sif_params, problem_properties, find_problems

File ~/opt/miniconda3/envs/env3.10/lib/python3.10/site-packages/pycutest/build_interface.py:16, in <module>
     14 from .system_paths import get_cache_path, get_sifdecoder_path
     15 from .c_interface import itf_c_source
---> 16 from .install_scripts import get_setup_script
     17 from .python_interface import get_init_script
     18 from .problem_class import CUTEstProblem

File ~/opt/miniconda3/envs/env3.10/lib/python3.10/site-packages/pycutest/install_scripts.py:97, in <module>
     76 setupScriptLinux="""
     77 define_macros=[('LINUX', None)]
     78 include_dirs=[os.path.join(np.get_include(), 'numpy'),os.environ['CUTEST']+'/include/']
   (...)
     83 extra_link_args=[]
     84 """
     86 #
     87 # Mac-specific part of setup.py
     88 #
     89 setupScriptMac="""
     90 define_macros=[('LINUX', None)]
     91 include_dirs=[os.path.join(np.get_include(), 'numpy'),os.environ['CUTEST']+'/include/']
     92 objFileList=glob('*.o')
     93 objFileList.append('%s')
     94 libraries=['gfortran']
     95 library_dirs=[max(glob('/usr/local/Cellar/gcc/*/lib/gcc/*/'),key=os.path.getmtime)]
     96 extra_link_args=['-Wl,-no_compact_unwind']
---> 97 """ % get_cutest_path()  # will probably get the homebrew location, but may revert to environment variables
    100 def get_setup_script():
    101     if sys.platform in ["linux", "linux2"]:

File ~/opt/miniconda3/envs/env3.10/lib/python3.10/site-packages/pycutest/system_paths.py:40, in get_cutest_path()
     38         return homebrew_path
     39     else:
---> 40         raise RuntimeError('Could not find CUTEST installation - have CUTEST and MYARCH environment variables been set correctly?')
     41 else:  # Linux
     42     check_environment_vars_exist(['CUTEST', 'MYARCH'])

RuntimeError: Could not find CUTEST installation - have CUTEST and MYARCH environment variables been set correctly?

Following your comments, I went back and tried (first deactivated my virtual env by conda deactivate):

source /usr/local/opt/archdefs/archdefs.bashrc
source /usr/local/opt/sifdecode/sifdecode.bashrc
export MASTSIF=/usr/local/opt/mastsif/
source /usr/local/opt/cutest/cutest.bashrc

Then I uninstall and reinstall pycutest in my env:

conda activate env3.10
pip uninstall pycutest
pip install pycutest

Retest,

import pycutest

It reports no error but only warning:

/Users/zhengy/opt/miniconda3/envs/env3.10/lib/python3.10/site-packages/pycutest/__init__.py:28: RuntimeWarning: the PYCUTEST_CACHE environment variable is not set; current folder will be used for caching.
  warnings.warn("the PYCUTEST_CACHE environment variable is not set; current folder will be used for caching.", RuntimeWarning)

However, when I move on to import problem "TAME",

pycutest.import_problem('TAME')

It reports error:

AttributeError                            Traceback (most recent call last)
Input In [4], in <cell line: 1>()
----> 1 pycutest.import_problem('TAME')

File ~/opt/miniconda3/envs/env3.10/lib/python3.10/site-packages/pycutest/build_interface.py:348, in import_problem(problemName, destination, sifParams, sifOptions, efirst, lfirst, nvfirst, quiet, drop_fixed_variables)
    346 # Import the module CACHE_SUBFOLDER.problemDir, and return a wrapper
    347 try:
--> 348     return CUTEstProblem(__import__('%s.%s' % (CACHE_SUBFOLDER, problemDir), globals(), locals(), [str(problemDir)]),
    349                          drop_fixed_variables=drop_fixed_variables)
    350 except ImportError as error:
    351     try: # check if cache folder is on python path

File ~/opt/miniconda3/envs/env3.10/lib/python3.10/site-packages/pycutest/problem_class.py:82, in CUTEstProblem.__init__(self, module, drop_fixed_variables)
     78 self.drop_fixed_vars = drop_fixed_variables
     80 # Extract useful problem info
---> 82 self.name = self._module.info['name']
     83 """ CUTEst problem name (string) """
     85 self.n = self._module.info['n']

AttributeError: module 'pycutest_cache_holder.TAME' has no attribute 'info'

This is where I stuck. Any hints or help please! Thank you so much!

from pycutest.

jfowkes avatar jfowkes commented on August 18, 2024

Hi @Zheng321, the attribute info is defined as a variable in pycutest_cache_holder/TAME*/__init__.py. Do you have that file? For me, in __init__.py I see lines 65-66:

# Set up the problem and get basic information
info=_pycutestitf._setup(efirst, lfirst, nvfirst)

which is where the info attribute is defined. Do you see anything like this?

from pycutest.

Zheng321 avatar Zheng321 commented on August 18, 2024

@jfowkes Thank you! I do not know where I can look for this file pycutest_cache_holder/TAME*/__init__.py? I'm poor in this and might need more detailed instructions, sorry.

I tried:

locate pycutest_cache_holder

It returns nothing. I also tried

locate pycutest_cache_holder/TAME*/__init__.py

It returns

zsh: no matches found: pycutest_cache_holder/TAME*/__init__.py

from pycutest.

jfowkes avatar jfowkes commented on August 18, 2024

@Zheng321 ah sorry, in the current directory PyCUTEst should have created a folder called pycutest_cache_holder:

~ $ python3
Python 3.10.6 (main, Sep 14 2022, 07:02:38) [GCC 11.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pycutest
/home/jari/.local/lib/python3.10/site-packages/pycutest/__init__.py:28: RuntimeWarning: the PYCUTEST_CACHE environment variable is not set; current folder will be used for caching.
  warnings.warn("the PYCUTEST_CACHE environment variable is not set; current folder will be used for caching.", RuntimeWarning)
>>> pycutest.import_problem('TAME')
<pycutest.problem_class.CUTEstProblem object at 0x7f022fb6ac20>
>>> 

And I can then see:

~ $ ls pycutest_cache_holder/TAME/
AUTOMAT.d  cutestitf.c  ELFUN.o  EXTER.o  GROUP.o      OUTSDIF.d    _pycutestitf.cpython-310-x86_64-linux-gnu.so  RANGE.o
build      ELFUN.f      EXTER.f  GROUP.f  __init__.py  __pycache__  RANGE.f                                       setup.py

from pycutest.

Zheng321 avatar Zheng321 commented on August 18, 2024

@jfowkes Got it! Sorry if I ask stupid questions.. I do have this folder pycutest_cache_holder, but to test from very beginning, I delete this whole folder manually, and start the following test.

Here is what I got using the exact same command as yours:

>>> import pycutest
/Users/zhengy/opt/miniconda3/envs/env3.10/lib/python3.10/site-packages/pycutest/__init__.py:28: RuntimeWarning: the PYCUTEST_CACHE environment variable is not set; current folder will be used for caching.
  warnings.warn("the PYCUTEST_CACHE environment variable is not set; current folder will be used for caching.", RuntimeWarning)
>>> pycutest.import_problem('TAME')

 ERROR: file TAME.SIF is not known in directories
 . or $MASTSIF


Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/zhengy/opt/miniconda3/envs/env3.10/lib/python3.10/site-packages/pycutest/build_interface.py", line 339, in import_problem
    objList = decode_and_compile_problem(problemName, destination, sifParams, sifOptions, quiet)
  File "/Users/zhengy/opt/miniconda3/envs/env3.10/lib/python3.10/site-packages/pycutest/build_interface.py", line 214, in decode_and_compile_problem
    raise RuntimeError('SIFDECODE failed, check output printed above')
RuntimeError: SIFDECODE failed, check output printed above

And the only file in this folder is __init__.py.

I note that if I do not delete this folder, then I got the same error as before.

>>> pycutest.import_problem('TAME')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/zhengy/opt/miniconda3/envs/env3.10/lib/python3.10/site-packages/pycutest/build_interface.py", line 348, in import_problem
    return CUTEstProblem(__import__('%s.%s' % (CACHE_SUBFOLDER, problemDir), globals(), locals(), [str(problemDir)]),
  File "/Users/zhengy/opt/miniconda3/envs/env3.10/lib/python3.10/site-packages/pycutest/problem_class.py", line 82, in __init__
    self.name = self._module.info['name']
AttributeError: module 'pycutest_cache_holder.TAME' has no attribute 'info'

I do not know when I generate this folder before, but these were the files in it:

% ls pycutest_cache_holder/TAME/
AUTOMAT.d	ELFUN.o		EXTER.o		GROUP.o		RANGE.f		cutestitf.c
ELFUN.f		EXTER.f		GROUP.f		OUTSDIF.d	RANGE.o		setup.py

Currently, I'm not able to generate this folder properly.

from pycutest.

jfowkes avatar jfowkes commented on August 18, 2024

@Zheng321 no problem! If you're getting the error

ERROR: file TAME.SIF is not known in directories
 . or $MASTSIF

it means that the MASTSIF environment variable is not defined, there should be a TAME.SIF in your /usr/local/opt/mastsif/ folder. However, this is not the main issue, so let's not worry about this for the moment.

It seems that for some reason the Python C Extension for TAME is not being compiled. Could you try:

% cd pycutest_cache_holder/TAME/
% python3 setup.py build_ext --inplace

and report the output of that command?

from pycutest.

Zheng321 avatar Zheng321 commented on August 18, 2024

@jfowkes I recover the folder manually for now and run the command, here is the output:

 % python3 setup.py build_ext --inplace
running build_ext
building '_pycutestitf' extension
creating build
creating build/temp.macosx-10.9-x86_64-cpython-310
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O2 -Wall -fPIC -O2 -isystem /Users/zhengy/opt/miniconda3/envs/env3.10/include -fPIC -O2 -isystem /Users/zhengy/opt/miniconda3/envs/env3.10/include -DLINUX -I/Users/zhengy/opt/miniconda3/envs/env3.10/lib/python3.10/site-packages/numpy/core/include/numpy -I/usr/local/opt/cutest/libexec/include/ -I/Users/zhengy/opt/miniconda3/envs/env3.10/include/python3.10 -c cutestitf.c -o build/temp.macosx-10.9-x86_64-cpython-310/cutestitf.o
creating build/lib.macosx-10.9-x86_64-cpython-310
clang -bundle -undefined dynamic_lookup -Wl,-rpath,/Users/zhengy/opt/miniconda3/envs/env3.10/lib -L/Users/zhengy/opt/miniconda3/envs/env3.10/lib -Wl,-rpath,/Users/zhengy/opt/miniconda3/envs/env3.10/lib -L/Users/zhengy/opt/miniconda3/envs/env3.10/lib build/temp.macosx-10.9-x86_64-cpython-310/cutestitf.o RANGE.o EXTER.o ELFUN.o GROUP.o /usr/local/opt/cutest/lib/libcutest.a -L/usr/local/Cellar/gcc/12.2.0/lib/gcc/11/ -lgfortran -o build/lib.macosx-10.9-x86_64-cpython-310/_pycutestitf.cpython-310-darwin.so -Wl,-no_compact_unwind
ld: warning: object file (GROUP.o) was built for newer macOS version (12.0) than being linked (10.9)
ld: warning: object file (EXTER.o) was built for newer macOS version (12.0) than being linked (10.9)
ld: warning: object file (RANGE.o) was built for newer macOS version (12.0) than being linked (10.9)
ld: warning: object file (ELFUN.o) was built for newer macOS version (12.0) than being linked (10.9)
ld: warning: object file (/usr/local/opt/cutest/lib/libcutest.a(cutest.o)) was built for newer macOS version (12.0) than being linked (10.9)
ld: warning: object file (/usr/local/opt/cutest/lib/libcutest.a(pname.o)) was built for newer macOS version (12.0) than being linked (10.9)
ld: warning: object file (/usr/local/opt/cutest/lib/libcutest.a(probname.o)) was built for newer macOS version (12.0) than being linked (10.9)
ld: warning: object file (/usr/local/opt/cutest/lib/libcutest.a(varnames.o)) was built for newer macOS version (12.0) than being linked (10.9)
ld: warning: object file (/usr/local/opt/cutest/lib/libcutest.a(newthread.o)) was built for newer macOS version (12.0) than being linked (10.9)
ld: warning: object file (/usr/local/opt/cutest/lib/libcutest.a(problem.o)) was built for newer macOS version (12.0) than being linked (10.9)
ld: warning: object file (/usr/local/opt/cutest/lib/libcutest.a(fortran_ops.o)) was built for newer macOS version (12.0) than being linked (10.9)
ld: warning: object file (/usr/local/opt/cutest/lib/libcutest.a(interface.o)) was built for newer macOS version (12.0) than being linked (10.9)
ld: warning: object file (/usr/local/opt/cutest/lib/libcutest.a(ccutest.o)) was built for newer macOS version (12.0) than being linked (10.9)
ld: warning: object file (/usr/local/opt/cutest/lib/libcutest.a(timings.o)) was built for newer macOS version (12.0) than being linked (10.9)
ld: warning: object file (/usr/local/opt/cutest/lib/libcutest.a(usetup.o)) was built for newer macOS version (12.0) than being linked (10.9)
ld: warning: object file (/usr/local/opt/cutest/lib/libcutest.a(udimen.o)) was built for newer macOS version (12.0) than being linked (10.9)
ld: warning: object file (/usr/local/opt/cutest/lib/libcutest.a(udimse.o)) was built for newer macOS version (12.0) than being linked (10.9)
ld: warning: object file (/usr/local/opt/cutest/lib/libcutest.a(udimsh.o)) was built for newer macOS version (12.0) than being linked (10.9)
ld: warning: object file (/usr/local/opt/cutest/lib/libcutest.a(unames.o)) was built for newer macOS version (12.0) than being linked (10.9)
ld: warning: object file (/usr/local/opt/cutest/lib/libcutest.a(uvartype.o)) was built for newer macOS version (12.0) than being linked (10.9)
ld: warning: object file (/usr/local/opt/cutest/lib/libcutest.a(ufn.o)) was built for newer macOS version (12.0) than being linked (10.9)
ld: warning: object file (/usr/local/opt/cutest/lib/libcutest.a(ugr.o)) was built for newer macOS version (12.0) than being linked (10.9)
ld: warning: object file (/usr/local/opt/cutest/lib/libcutest.a(uofg.o)) was built for newer macOS version (12.0) than being linked (10.9)
ld: warning: object file (/usr/local/opt/cutest/lib/libcutest.a(udh.o)) was built for newer macOS version (12.0) than being linked (10.9)
ld: warning: object file (/usr/local/opt/cutest/lib/libcutest.a(ugrdh.o)) was built for newer macOS version (12.0) than being linked (10.9)
ld: warning: object file (/usr/local/opt/cutest/lib/libcutest.a(ush.o)) was built for newer macOS version (12.0) than being linked (10.9)
ld: warning: object file (/usr/local/opt/cutest/lib/libcutest.a(ushp.o)) was built for newer macOS version (12.0) than being linked (10.9)
ld: warning: object file (/usr/local/opt/cutest/lib/libcutest.a(ueh.o)) was built for newer macOS version (12.0) than being linked (10.9)
ld: warning: object file (/usr/local/opt/cutest/lib/libcutest.a(ugreh.o)) was built for newer macOS version (12.0) than being linked (10.9)
ld: warning: object file (/usr/local/opt/cutest/lib/libcutest.a(ugrsh.o)) was built for newer macOS version (12.0) than being linked (10.9)
ld: warning: object file (/usr/local/opt/cutest/lib/libcutest.a(uhprod.o)) was built for newer macOS version (12.0) than being linked (10.9)
ld: warning: object file (/usr/local/opt/cutest/lib/libcutest.a(ushprod.o)) was built for newer macOS version (12.0) than being linked (10.9)
ld: warning: object file (/usr/local/opt/cutest/lib/libcutest.a(ubandh.o)) was built for newer macOS version (12.0) than being linked (10.9)
ld: warning: object file (/usr/local/opt/cutest/lib/libcutest.a(ureport.o)) was built for newer macOS version (12.0) than being linked (10.9)
ld: warning: object file (/usr/local/opt/cutest/lib/libcutest.a(uterminate.o)) was built for newer macOS version (12.0) than being linked (10.9)
ld: warning: object file (/usr/local/opt/cutest/lib/libcutest.a(csetup.o)) was built for newer macOS version (12.0) than being linked (10.9)
ld: warning: object file (/usr/local/opt/cutest/lib/libcutest.a(cdimen.o)) was built for newer macOS version (12.0) than being linked (10.9)
ld: warning: object file (/usr/local/opt/cutest/lib/libcutest.a(cdimse.o)) was built for newer macOS version (12.0) than being linked (10.9)
ld: warning: object file (/usr/local/opt/cutest/lib/libcutest.a(cdimsh.o)) was built for newer macOS version (12.0) than being linked (10.9)
ld: warning: object file (/usr/local/opt/cutest/lib/libcutest.a(cdimsj.o)) was built for newer macOS version (12.0) than being linked (10.9)
ld: warning: object file (/usr/local/opt/cutest/lib/libcutest.a(cdimchp.o)) was built for newer macOS version (12.0) than being linked (10.9)
ld: warning: object file (/usr/local/opt/cutest/lib/libcutest.a(cnames.o)) was built for newer macOS version (12.0) than being linked (10.9)
ld: warning: object file (/usr/local/opt/cutest/lib/libcutest.a(cvartype.o)) was built for newer macOS version (12.0) than being linked (10.9)
ld: warning: object file (/usr/local/opt/cutest/lib/libcutest.a(cfn.o)) was built for newer macOS version (12.0) than being linked (10.9)
ld: warning: object file (/usr/local/opt/cutest/lib/libcutest.a(cgr.o)) was built for newer macOS version (12.0) than being linked (10.9)
ld: warning: object file (/usr/local/opt/cutest/lib/libcutest.a(cofg.o)) was built for newer macOS version (12.0) than being linked (10.9)
ld: warning: object file (/usr/local/opt/cutest/lib/libcutest.a(cofsg.o)) was built for newer macOS version (12.0) than being linked (10.9)
ld: warning: object file (/usr/local/opt/cutest/lib/libcutest.a(ccfg.o)) was built for newer macOS version (12.0) than being linked (10.9)
ld: warning: object file (/usr/local/opt/cutest/lib/libcutest.a(clfg.o)) was built for newer macOS version (12.0) than being linked (10.9)
ld: warning: object file (/usr/local/opt/cutest/lib/libcutest.a(ccfsg.o)) was built for newer macOS version (12.0) than being linked (10.9)
ld: warning: object file (/usr/local/opt/cutest/lib/libcutest.a(ccifg.o)) was built for newer macOS version (12.0) than being linked (10.9)
ld: warning: object file (/usr/local/opt/cutest/lib/libcutest.a(ccifsg.o)) was built for newer macOS version (12.0) than being linked (10.9)
ld: warning: object file (/usr/local/opt/cutest/lib/libcutest.a(cdh.o)) was built for newer macOS version (12.0) than being linked (10.9)
ld: warning: object file (/usr/local/opt/cutest/lib/libcutest.a(cdhc.o)) was built for newer macOS version (12.0) than being linked (10.9)
ld: warning: object file (/usr/local/opt/cutest/lib/libcutest.a(ceh.o)) was built for newer macOS version (12.0) than being linked (10.9)
ld: warning: object file (/usr/local/opt/cutest/lib/libcutest.a(cgrdh.o)) was built for newer macOS version (12.0) than being linked (10.9)
ld: warning: object file (/usr/local/opt/cutest/lib/libcutest.a(cifn.o)) was built for newer macOS version (12.0) than being linked (10.9)
ld: warning: object file (/usr/local/opt/cutest/lib/libcutest.a(cigr.o)) was built for newer macOS version (12.0) than being linked (10.9)
ld: warning: object file (/usr/local/opt/cutest/lib/libcutest.a(cisgr.o)) was built for newer macOS version (12.0) than being linked (10.9)
ld: warning: object file (/usr/local/opt/cutest/lib/libcutest.a(cidh.o)) was built for newer macOS version (12.0) than being linked (10.9)
ld: warning: object file (/usr/local/opt/cutest/lib/libcutest.a(csh.o)) was built for newer macOS version (12.0) than being linked (10.9)
ld: warning: object file (/usr/local/opt/cutest/lib/libcutest.a(cshc.o)) was built for newer macOS version (12.0) than being linked (10.9)
ld: warning: object file (/usr/local/opt/cutest/lib/libcutest.a(cshp.o)) was built for newer macOS version (12.0) than being linked (10.9)
ld: warning: object file (/usr/local/opt/cutest/lib/libcutest.a(cish.o)) was built for newer macOS version (12.0) than being linked (10.9)
ld: warning: object file (/usr/local/opt/cutest/lib/libcutest.a(cjprod.o)) was built for newer macOS version (12.0) than being linked (10.9)
ld: warning: object file (/usr/local/opt/cutest/lib/libcutest.a(cstats.o)) was built for newer macOS version (12.0) than being linked (10.9)
ld: warning: object file (/usr/local/opt/cutest/lib/libcutest.a(csgr.o)) was built for newer macOS version (12.0) than being linked (10.9)
ld: warning: object file (/usr/local/opt/cutest/lib/libcutest.a(csgreh.o)) was built for newer macOS version (12.0) than being linked (10.9)
ld: warning: object file (/usr/local/opt/cutest/lib/libcutest.a(csgrsh.o)) was built for newer macOS version (12.0) than being linked (10.9)
ld: warning: object file (/usr/local/opt/cutest/lib/libcutest.a(csjprod.o)) was built for newer macOS version (12.0) than being linked (10.9)
ld: warning: object file (/usr/local/opt/cutest/lib/libcutest.a(chprod.o)) was built for newer macOS version (12.0) than being linked (10.9)
ld: warning: object file (/usr/local/opt/cutest/lib/libcutest.a(chcprod.o)) was built for newer macOS version (12.0) than being linked (10.9)
ld: warning: object file (/usr/local/opt/cutest/lib/libcutest.a(cshprod.o)) was built for newer macOS version (12.0) than being linked (10.9)
ld: warning: object file (/usr/local/opt/cutest/lib/libcutest.a(cshcprod.o)) was built for newer macOS version (12.0) than being linked (10.9)
ld: warning: object file (/usr/local/opt/cutest/lib/libcutest.a(cchprods.o)) was built for newer macOS version (12.0) than being linked (10.9)
ld: warning: object file (/usr/local/opt/cutest/lib/libcutest.a(csjp.o)) was built for newer macOS version (12.0) than being linked (10.9)
ld: warning: object file (/usr/local/opt/cutest/lib/libcutest.a(csgrp.o)) was built for newer macOS version (12.0) than being linked (10.9)
ld: warning: object file (/usr/local/opt/cutest/lib/libcutest.a(csgrshp.o)) was built for newer macOS version (12.0) than being linked (10.9)
ld: warning: object file (/usr/local/opt/cutest/lib/libcutest.a(cchprodsp.o)) was built for newer macOS version (12.0) than being linked (10.9)
ld: warning: object file (/usr/local/opt/cutest/lib/libcutest.a(creport.o)) was built for newer macOS version (12.0) than being linked (10.9)
ld: warning: object file (/usr/local/opt/cutest/lib/libcutest.a(connames.o)) was built for newer macOS version (12.0) than being linked (10.9)
ld: warning: object file (/usr/local/opt/cutest/lib/libcutest.a(cterminate.o)) was built for newer macOS version (12.0) than being linked (10.9)
ld: warning: object file (/usr/local/opt/cutest/lib/libcutest.a(lqp.o)) was built for newer macOS version (12.0) than being linked (10.9)
ld: warning: object file (/usr/local/opt/cutest/lib/libcutest.a(cconst.o)) was built for newer macOS version (12.0) than being linked (10.9)
copying build/lib.macosx-10.9-x86_64-cpython-310/_pycutestitf.cpython-310-darwin.so -> 

from pycutest.

jfowkes avatar jfowkes commented on August 18, 2024

@jfowkes okay it seems Anaconda is targeting a very old macOS version, could you set:

export MACOSX_DEPLOYMENT_TARGET=12.0

and try again? That should hopefully resolve the missing __init__.py issue.

from pycutest.

Zheng321 avatar Zheng321 commented on August 18, 2024

@jfowkes Thank you! This is what I got:

% Python3 setup.py build_ext --inplace
running build_ext
copying build/lib.macosx-10.9-x86_64-cpython-310/_pycutestitf.cpython-310-darwin.so -> 

But the issue still persists,

ycutest.import_problem('TAME')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/zhengy/opt/miniconda3/envs/env3.10/lib/python3.10/site-packages/pycutest/build_interface.py", line 348, in import_problem
    return CUTEstProblem(__import__('%s.%s' % (CACHE_SUBFOLDER, problemDir), globals(), locals(), [str(problemDir)]),
  File "/Users/zhengy/opt/miniconda3/envs/env3.10/lib/python3.10/site-packages/pycutest/problem_class.py", line 82, in __init__
    self.name = self._module.info['name']
AttributeError: module 'pycutest_cache_holder.TAME' has no attribute 'info'

Here is what I have in the folder:

% ls pycutest_cache_holder/TAME/
AUTOMAT.d				GROUP.f					_pycutestitf.cpython-310-darwin.so
ELFUN.f					GROUP.o					build
ELFUN.o					OUTSDIF.d				cutestitf.c
EXTER.f					RANGE.f					setup.py
EXTER.o					RANGE.o

from pycutest.

jfowkes avatar jfowkes commented on August 18, 2024

@Zheng321 thank you, could you try running again with:

conda deactivate
conda activate env3.10
source ~/.bashrc
export MACOSX_DEPLOYMENT_TARGET=12.0
rm -r pycutest_cache_holder

and then testing again in python:

import pycutest
pycutest.import_problem('TAME')

I'm interested to see what happens.

from pycutest.

Zheng321 avatar Zheng321 commented on August 18, 2024

@jfowkes ofc, anything you'd like to try.

Here is what I got:

>>> import pycutest
/Users/zhengy/opt/miniconda3/envs/env3.10/lib/python3.10/site-packages/pycutest/__init__.py:28: RuntimeWarning: the PYCUTEST_CACHE environment variable is not set; current folder will be used for caching.
  warnings.warn("the PYCUTEST_CACHE environment variable is not set; current folder will be used for caching.", RuntimeWarning)
>>> pycutest.import_problem('TAME')
ld: warning: -undefined dynamic_lookup may not work with chained fixups
<pycutest.problem_class.CUTEstProblem object at 0x7f9a16a7cdf0>

from pycutest.

Zheng321 avatar Zheng321 commented on August 18, 2024

@jfowkes I think it is fixed! Thank you! I'm able to run my algorithm on TAME now. I never try source ~/.bashrc this before, I thought it is automatically executed..

from pycutest.

jfowkes avatar jfowkes commented on August 18, 2024

@Zheng321 excellent! It seems what was happening is that the environment variables from ~/.bashrc were not automatically visible in your conda environment and this was causing the TAME problem not to fully compile for some reason. Deleting pycutest_cache_holder forced PyCUTEst to recompile, it is often a good idea to clear out the cache if you're having issues.

I will test this all out properly when I have access to my Macbook on Thursday and update the Mac install docs for Anaconda.

from pycutest.

jfowkes avatar jfowkes commented on August 18, 2024

This seems to be the exact same issue as #25 from another Anaconda user.

from pycutest.

Related Issues (20)

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.