Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trouble installing gamera 4.1.0 #72

Open
vhmangaiha opened this issue Aug 18, 2023 · 12 comments
Open

Trouble installing gamera 4.1.0 #72

vhmangaiha opened this issue Aug 18, 2023 · 12 comments

Comments

@vhmangaiha
Copy link

I am following the installation steps given in the website . I have downloaded gamera 4.1.0.
I have install virtual environment and wxPython .
But when i try to install it , the following problem is coming .

(base) vkhiangte@Vanlalhmangaihas-iMac gameratool % source /Users/vkhiangte/Documents/gameratool/bin/activate
(gameratool) (base) vkhiangte@Vanlalhmangaihas-iMac gameratool % cd /Users/vkhiangte/Documents/gameratool/gamera-4.1.0 
(gameratool) (base) vkhiangte@Vanlalhmangaihas-iMac gamera-4.1.0 % pip3 install .
Processing /Users/vkhiangte/Documents/gameratool/gamera-4.1.0
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [42 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/Users/vkhiangte/Documents/gameratool/gamera-4.1.0/setup.py", line 50, in <module>
          plugin_extensions = gamera_setup.generate_plugins(plugins, "gamera.plugins")
        File "/Users/vkhiangte/Documents/gameratool/gamera-4.1.0/gamera/gamera_setup.py", line 104, in generate_plugins
          extension = generate.generate_plugin(
        File "/Users/vkhiangte/Documents/gameratool/gamera-4.1.0/gamera/generate.py", line 328, in generate_plugin
          plugin_module = __import__(module_name)
        File "/Users/vkhiangte/Documents/gameratool/gamera-4.1.0/gamera/generate.py", line 79, in magic_import
          return std_import(name, globals_, locals_, fromlist, level)
        File "/Users/vkhiangte/Documents/gameratool/gamera-4.1.0/gamera/plugins/png_support.py", line 78, in <module>
          class PngSupportModule(PluginModule):
        File "/Users/vkhiangte/Documents/gameratool/gamera-4.1.0/gamera/plugins/png_support.py", line 96, in PngSupportModule
          cpp_sources = [os.path.join(internal_png_dir, x) for x in
        File "/Users/vkhiangte/Documents/gameratool/gamera-4.1.0/gamera/plugins/png_support.py", line 96, in <listcomp>
          cpp_sources = [os.path.join(internal_png_dir, x) for x in
      NameError: name 'internal_png_dir' is not defined
      
      Gamera version: 4.1.0
      skipping wrapper generation for corelation plugin (output up-to-date)
      skipping wrapper generation for structural plugin (output up-to-date)
      skipping wrapper generation for arithmetic plugin (output up-to-date)
      skipping wrapper generation for transformation plugin (output up-to-date)
      skipping wrapper generation for color plugin (output up-to-date)
      skipping wrapper generation for convolution plugin (output up-to-date)
      skipping wrapper generation for gui_support plugin (output up-to-date)
      skipping wrapper generation for logical plugin (output up-to-date)
      skipping wrapper generation for fourier_features plugin (output up-to-date)
      skipping wrapper generation for pagesegmentation plugin (output up-to-date)
      skipping wrapper generation for features plugin (output up-to-date)
      skipping wrapper generation for misc_free_functions plugin (output up-to-date)
      skipping wrapper generation for binarization plugin (output up-to-date)
      skipping wrapper generation for image_conversion plugin (output up-to-date)
      skipping wrapper generation for threshold plugin (output up-to-date)
      skipping wrapper generation for deformation plugin (output up-to-date)
      skipping wrapper generation for morphology plugin (output up-to-date)
      skipping wrapper generation for tiff_support plugin (output up-to-date)
      skipping wrapper generation for geometry plugin (output up-to-date)
      skipping wrapper generation for listutilities plugin (output up-to-date)
      skipping wrapper generation for image_utilities plugin (output up-to-date)
      skipping wrapper generation for misc_filters plugin (output up-to-date)
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

Thanks in advance

@FriedrichFroebel
Copy link
Contributor

Which download link are you using from https://github.com/hsnr-gamera/gamera-4/releases/tag/v4.1.0? The auto-generated source code ones or the manually uploaded gamera-* files? On my side, I have used the auto-generated ones without issues in the past, while I am not sure how the other ones actually are being created.

@FriedrichFroebel
Copy link
Contributor

Could you please check what the content of the corresponding file is? The offending code branch is

cpp_sources = [os.path.join(internal_png_dir, x) for x in
['png.c', 'pngset.c', 'pngget.c', 'pngrutil.c',
'pngtrans.c', 'pngwutil.c', 'pngread.c', 'pngrio.c',
'pngwio.c', 'pngwrite.c', 'pngrtran.c', 'pngwtran.c',
'pngmem.c', 'pngerror.c', 'pngpread.c']]
cpp_include_dirs = [internal_png_dir]
# zlib, which apparently is included in OS-X 10.3 by default
extra_libraries = ["z"]
The variable should be defined in https://github.com/hsnr-gamera/gamera-4/blob/270e499abcb20dd6d77e8df840c3ef0c1ae02a2c/gamera/plugins/png_support.py#L83C5-L83C21 Is the code the same in your case?

@vhmangaiha
Copy link
Author

Yes, i have checked it, it is the same ..

            cpp_sources = [os.path.join(internal_png_dir, x) for x in
                           ['png.c', 'pngset.c', 'pngget.c', 'pngrutil.c',
                            'pngtrans.c', 'pngwutil.c', 'pngread.c', 'pngrio.c',
                            'pngwio.c', 'pngwrite.c', 'pngrtran.c', 'pngwtran.c',
                            'pngmem.c', 'pngerror.c', 'pngpread.c']]
            cpp_include_dirs = [internal_png_dir]
            # zlib, which apparently is included in OS-X 10.3 by default
            extra_libraries = ["z"]

My MacOs is

(base) vkhiangte@Vanlalhmangaihas-iMac ~ % sw_vers 
ProductName:		macOS
ProductVersion:		13.0
BuildVersion:		22A380

@FriedrichFroebel
Copy link
Contributor

Strangely enough, the value should always be defined:

internal_png_dir = "src/libpng-1.2.5/"

Which Python version are you using? Is there any useful additional output if you try to install Gamera with the --verbose flag?

@vhmangaiha
Copy link
Author

The above is the same ..
Running with --verbose option

(base) vkhiangte@Vanlalhmangaihas-iMac ~ % python --version
Python 3.9.13
(base) vkhiangte@Vanlalhmangaihas-iMac ~ % source /Users/vkhiangte/Documents/gameratool/bin/activate
(gameratool) (base) vkhiangte@Vanlalhmangaihas-iMac ~ % cd /Users/vkhiangte/Documents/gameratool/gamera-4.1.0
(gameratool) (base) vkhiangte@Vanlalhmangaihas-iMac gamera-4.1.0 % pip3 install . --verbose
Using pip 23.2.1 from /Users/vkhiangte/Documents/gameratool/lib/python3.9/site-packages/pip (python 3.9)
Processing /Users/vkhiangte/Documents/gameratool/gamera-4.1.0
  Running command python setup.py egg_info
  Traceback (most recent call last):
    File "<string>", line 2, in <module>
    File "<pip-setuptools-caller>", line 34, in <module>
    File "/Users/vkhiangte/Documents/gameratool/gamera-4.1.0/setup.py", line 50, in <module>
      plugin_extensions = gamera_setup.generate_plugins(plugins, "gamera.plugins")
    File "/Users/vkhiangte/Documents/gameratool/gamera-4.1.0/gamera/gamera_setup.py", line 104, in generate_plugins
      extension = generate.generate_plugin(
    File "/Users/vkhiangte/Documents/gameratool/gamera-4.1.0/gamera/generate.py", line 328, in generate_plugin
      plugin_module = __import__(module_name)
    File "/Users/vkhiangte/Documents/gameratool/gamera-4.1.0/gamera/generate.py", line 79, in magic_import
      return std_import(name, globals_, locals_, fromlist, level)
    File "/Users/vkhiangte/Documents/gameratool/gamera-4.1.0/gamera/plugins/png_support.py", line 78, in <module>
      class PngSupportModule(PluginModule):
    File "/Users/vkhiangte/Documents/gameratool/gamera-4.1.0/gamera/plugins/png_support.py", line 96, in PngSupportModule
      cpp_sources = [os.path.join(internal_png_dir, x) for x in
    File "/Users/vkhiangte/Documents/gameratool/gamera-4.1.0/gamera/plugins/png_support.py", line 96, in <listcomp>
      cpp_sources = [os.path.join(internal_png_dir, x) for x in
  NameError: name 'internal_png_dir' is not defined

  Gamera version: 4.1.0
  skipping wrapper generation for corelation plugin (output up-to-date)
  skipping wrapper generation for structural plugin (output up-to-date)
  skipping wrapper generation for arithmetic plugin (output up-to-date)
  skipping wrapper generation for transformation plugin (output up-to-date)
  skipping wrapper generation for color plugin (output up-to-date)
  skipping wrapper generation for convolution plugin (output up-to-date)
  skipping wrapper generation for gui_support plugin (output up-to-date)
  skipping wrapper generation for logical plugin (output up-to-date)
  skipping wrapper generation for fourier_features plugin (output up-to-date)
  skipping wrapper generation for pagesegmentation plugin (output up-to-date)
  skipping wrapper generation for features plugin (output up-to-date)
  skipping wrapper generation for misc_free_functions plugin (output up-to-date)
  skipping wrapper generation for binarization plugin (output up-to-date)
  skipping wrapper generation for image_conversion plugin (output up-to-date)
  skipping wrapper generation for threshold plugin (output up-to-date)
  skipping wrapper generation for deformation plugin (output up-to-date)
  skipping wrapper generation for morphology plugin (output up-to-date)
  skipping wrapper generation for tiff_support plugin (output up-to-date)
  skipping wrapper generation for geometry plugin (output up-to-date)
  skipping wrapper generation for listutilities plugin (output up-to-date)
  skipping wrapper generation for image_utilities plugin (output up-to-date)
  skipping wrapper generation for misc_filters plugin (output up-to-date)
  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> See above for output.
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  full command: /Users/vkhiangte/Documents/gameratool/bin/python -c '
  exec(compile('"'"''"'"''"'"'
  # This is <pip-setuptools-caller> -- a caller that pip uses to run setup.py
  #
  # - It imports setuptools before invoking setup.py, to enable projects that directly
  #   import from `distutils.core` to work with newer packaging standards.
  # - It provides a clear error message when setuptools is not installed.
  # - It sets `sys.argv[0]` to the underlying `setup.py`, when invoking `setup.py` so
  #   setuptools doesn'"'"'t think the script is `-c`. This avoids the following warning:
  #     manifest_maker: standard file '"'"'-c'"'"' not found".
  # - It generates a shim setup.py, for handling setup.cfg-only projects.
  import os, sys, tokenize
  
  try:
      import setuptools
  except ImportError as error:
      print(
          "ERROR: Can not execute `setup.py` since setuptools is not available in "
          "the build environment.",
          file=sys.stderr,
      )
      sys.exit(1)
  
  __file__ = %r
  sys.argv[0] = __file__
  
  if os.path.exists(__file__):
      filename = __file__
      with tokenize.open(__file__) as f:
          setup_py_code = f.read()
  else:
      filename = "<auto-generated setuptools caller>"
      setup_py_code = "from setuptools import setup; setup()"
  
  exec(compile(setup_py_code, filename, "exec"))
  '"'"''"'"''"'"' % ('"'"'/Users/vkhiangte/Documents/gameratool/gamera-4.1.0/setup.py'"'"',), "<pip-setuptools-caller>", "exec"))' egg_info --egg-base /private/var/folders/3z/5dl0yfsn5y3djldmfhr_vpmh0000gn/T/pip-pip-egg-info-hzw_w026
  cwd: /Users/vkhiangte/Documents/gameratool/gamera-4.1.0/
  Preparing metadata (setup.py) ... error
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

@FriedrichFroebel
Copy link
Contributor

As mentioned before, this appears to be rather strange and the corresponding constructs should work in theory. Could you please try to debug where the class attribute gets lost?

@kyrieb-ekat
Copy link

Hello,

I am having the same problem. I followed the installation instructions for the virtualenv and wxPython (etc.), installing Gamera with python3 setup.py bdist_wheel && sudo pip3 install ./dist/gamera-*-*.whl into the correct directory, and got the following:

Gamera version: 4.1.0
generating wrappers for corelation plugin
generating wrappers for structural plugin
generating wrappers for arithmetic plugin
generating wrappers for transformation plugin
generating wrappers for color plugin
generating wrappers for convolution plugin
generating wrappers for gui_support plugin
generating wrappers for logical plugin
generating wrappers for fourier_features plugin
generating wrappers for pagesegmentation plugin
generating wrappers for features plugin
generating wrappers for misc_free_functions plugin
generating wrappers for binarization plugin
generating wrappers for image_conversion plugin
generating wrappers for threshold plugin
generating wrappers for deformation plugin
generating wrappers for morphology plugin
generating wrappers for tiff_support plugin
generating wrappers for geometry plugin
generating wrappers for listutilities plugin
generating wrappers for image_utilities plugin
generating wrappers for misc_filters plugin
Traceback (most recent call last):
  File "/Users/name/Documents/GitHub/gamera-4/setup.py", line 52, in <module>
    plugin_extensions = gamera_setup.generate_plugins(plugins, "gamera.plugins")
  File "/Users/name/Documents/GitHub/gamera-4/gamera/gamera_setup.py", line 104, in generate_plugins
    extension = generate.generate_plugin(
  File "/Users/name/Documents/GitHub/gamera-4/gamera/generate.py", line 328, in generate_plugin
    plugin_module = __import__(module_name)
  File "/Users/name/Documents/GitHub/gamera-4/gamera/generate.py", line 79, in magic_import
    return std_import(name, globals_, locals_, fromlist, level)
  File "/Users/name/Documents/GitHub/gamera-4/gamera/plugins/png_support.py", line 78, in <module>
    class PngSupportModule(PluginModule):
  File "/Users/name/Documents/GitHub/gamera-4/gamera/plugins/png_support.py", line 96, in PngSupportModule
    cpp_sources = [os.path.join(internal_png_dir, x) for x in
  File "/Users/name/Documents/GitHub/gamera-4/gamera/plugins/png_support.py", line 96, in <listcomp>
    cpp_sources = [os.path.join(internal_png_dir, x) for x in
NameError: name 'internal_png_dir' is not defined

I then went to the more in depth page and followed the directions there culminating in the pip install . directions, and got the following error:

name@device gamera-4 % pip install .
Processing /Users/name/Documents/GitHub/gamera-4
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error
  
  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [53 lines of output]
      
      Gamera version: 4.1.0
      skipping wrapper generation for corelation plugin (output up-to-date)
      skipping wrapper generation for structural plugin (output up-to-date)
      skipping wrapper generation for arithmetic plugin (output up-to-date)
      skipping wrapper generation for transformation plugin (output up-to-date)
      skipping wrapper generation for color plugin (output up-to-date)
      skipping wrapper generation for convolution plugin (output up-to-date)
      skipping wrapper generation for gui_support plugin (output up-to-date)
      skipping wrapper generation for logical plugin (output up-to-date)
      skipping wrapper generation for fourier_features plugin (output up-to-date)
      skipping wrapper generation for pagesegmentation plugin (output up-to-date)
      skipping wrapper generation for features plugin (output up-to-date)
      skipping wrapper generation for misc_free_functions plugin (output up-to-date)
      skipping wrapper generation for binarization plugin (output up-to-date)
      skipping wrapper generation for image_conversion plugin (output up-to-date)
      skipping wrapper generation for threshold plugin (output up-to-date)
      skipping wrapper generation for deformation plugin (output up-to-date)
      skipping wrapper generation for morphology plugin (output up-to-date)
      skipping wrapper generation for tiff_support plugin (output up-to-date)
      skipping wrapper generation for geometry plugin (output up-to-date)
      skipping wrapper generation for listutilities plugin (output up-to-date)
      skipping wrapper generation for image_utilities plugin (output up-to-date)
      skipping wrapper generation for misc_filters plugin (output up-to-date)
      Traceback (most recent call last):
        File "/Users/name/opt/anaconda3/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/Users/name/opt/anaconda3/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/Users/name/opt/anaconda3/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
        File "/private/var/folders/bw/lyc3370x0771s3nq0l2c16pw0000gn/T/pip-build-env-enobkqq9/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 325, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=['wheel'])
        File "/private/var/folders/bw/lyc3370x0771s3nq0l2c16pw0000gn/T/pip-build-env-enobkqq9/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 295, in _get_build_requires
          self.run_setup()
        File "/private/var/folders/bw/lyc3370x0771s3nq0l2c16pw0000gn/T/pip-build-env-enobkqq9/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 487, in run_setup
          super().run_setup(setup_script=setup_script)
        File "/private/var/folders/bw/lyc3370x0771s3nq0l2c16pw0000gn/T/pip-build-env-enobkqq9/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 311, in run_setup
          exec(code, locals())
        File "<string>", line 52, in <module>
        File "/Users/name/Documents/GitHub/gamera-4/gamera/gamera_setup.py", line 104, in generate_plugins
          extension = generate.generate_plugin(
        File "/Users/name/Documents/GitHub/gamera-4/gamera/generate.py", line 328, in generate_plugin
          plugin_module = __import__(module_name)
        File "/Users/name/Documents/GitHub/gamera-4/gamera/generate.py", line 79, in magic_import
          return std_import(name, globals_, locals_, fromlist, level)
        File "/Users/name/Documents/GitHub/gamera-4/gamera/plugins/png_support.py", line 78, in <module>
          class PngSupportModule(PluginModule):
        File "/Users/name/Documents/GitHub/gamera-4/gamera/plugins/png_support.py", line 96, in PngSupportModule
          cpp_sources = [os.path.join(internal_png_dir, x) for x in
        File "/Users/name/Documents/GitHub/gamera-4/gamera/plugins/png_support.py", line 96, in <listcomp>
          cpp_sources = [os.path.join(internal_png_dir, x) for x in
      NameError: name 'internal_png_dir' is not defined
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

I checked the referred file png_support.py as discussed above and have the following:

    internal_png_dir = "src/libpng-1.2.5/"

and

    elif sys.platform in ('win32', 'cygwin'):
        cpp_sources = [os.path.join(internal_png_dir, x) for x in
                       ['png.c', 'pngset.c', 'pngget.c', 'pngrutil.c',
                        'pngtrans.c', 'pngwutil.c', 'pngread.c', 'pngrio.c',
                        'pngwio.c', 'pngwrite.c', 'pngrtran.c', 'pngwtran.c',
                        'pngmem.c', 'pngerror.c', 'pngpread.c',]]
        cpp_sources.extend([os.path.join(internal_zlib_dir, x) for x in
                            ['adler32.c','compress.c','crc32.c','deflate.c',
                             'gzclose.c','gzlib.c','gzread.c','gzwrite.c',
                             'infback.c','inffast.c','inflate.c','inftrees.c',
                             'trees.c','uncompr.c','zutil.c']])
        cpp_include_dirs = [internal_png_dir, "include/zlib-1.2.8"]
#        extra_libraries = ["z"]

However, in the above block internal_png_dir flags as undefined.
Screenshot 2024-05-29 at 10 34 02 AM

In running a --verbose version, I got an additional

error: subprocess-exited-with-error
  
  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> See above for output.
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  full command: /Users/name/opt/anaconda3/bin/python /name/kyrie/opt/anaconda3/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py get_requires_for_build_wheel /var/folders/bw/lyc3370x0771s3nq0l2c16pw0000gn/T/tmp3fs82kv9
  cwd: /Users/name/Documents/GitHub/gamera-4
  Getting requirements to build wheel ... error
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

I tried to find an earlier released version, but they also seem to have the same issue. I'm not really sure where to go from here, or if I missed something obvious. Any direction/pointers appreciated!

@FriedrichFroebel
Copy link
Contributor

Installing libpng globally could be a possible workaround in theory. It seems like the Darwin platform has never been tested thoroughly. The way the corresponding values are determined looks strange anyway - doing some standalone tests without the star import from gamera.plugin, os is undefined even earlier.

@kyrieb-ekat
Copy link

So I do have libpng installed globally (via Homebrew); is it potentially worthwhile to try running a version of linux in docker (ubuntu 20 or 22?)

@FriedrichFroebel
Copy link
Contributor

Continuous integration for the gamera-4 package itself (and for one of the downstream applications for which I am relying on) as well as my local installations use Ubuntu 22.04.

I do not know where Homebrew installs the package and especially the development header for the detection logic in

for p in ["/sw", "/usr", "/usr/local"]:
if os.path.exists(os.path.join(p, "include/png.h")):
but you might just need to extend/adapt the list for your setup to avoid running containers.

@kyrieb-ekat
Copy link

I added the homebrew path in line 87—it worked and allowed install!! Thank you so much!

@FriedrichFroebel
Copy link
Contributor

Feel free to submit a corresponding PR if this is a generic path which could be useful for others. This does not solve the issue with the embedded copy of the libraries, but at least increases the chance of a successful build if the required headers already are installed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants