f90wrap icon indicating copy to clipboard operation
f90wrap copied to clipboard

pip installation on windows fails with 'ValueError: path cannot be absolute'

Open jmp75 opened this issue 6 years ago • 4 comments
trafficstars

Repro:

Windows 10

conda activate my_env

installing mingw following these instructions

pip install f90wrap
ValueError: path '/Users/jameskermode/.pyenv/versions/3.6.6/lib/python3.6/site-packages/numpy/f2py/src/fortranobject.c' cannot be absolute

Installing from source with python setup.py develop seems to work fine however.

jmp75 avatar Nov 03 '19 02:11 jmp75

Here is a backtrace for the above error

  Running command 'C:\cibw\python\pythonx86.3.9.9\tools\python.exe' 'C:\Users\jared\AppData\Local\Temp\pip-standalone-pip-9fpkf92h\__env_pip__.zip\pip' install --ignore-installed --no-user --prefix 'C:\Users\jared\AppData\Local\Temp\pip-build-env-ixdeb5f5\overlay' --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- 'setuptools>=45' 'setuptools_scm>=6.2' wheel numpy f90wrap
  Collecting setuptools>=45
    Using cached setuptools-60.10.0-py3-none-any.whl (1.1 MB)
  Collecting setuptools_scm>=6.2
    Using cached setuptools_scm-6.4.2-py3-none-any.whl (37 kB)
  Collecting wheel
    Using cached wheel-0.37.1-py2.py3-none-any.whl (35 kB)
  Collecting numpy
    Using cached numpy-1.22.3-cp39-cp39-win32.whl (12.2 MB)
  Collecting f90wrap
    Using cached f90wrap-0.2.7.tar.gz (80 kB)
    Installing build dependencies: started
    Installing build dependencies: finished with status 'done'
    Getting requirements to build wheel: started
    Getting requirements to build wheel: finished with status 'error'
    ERROR: Command errored out with exit status 1:
     command: 'C:\cibw\python\pythonx86.3.9.9\tools\python.exe' 'C:\Users\jared\AppData\Local\Temp\tmpevpnxme0_in_process.py' get_requires_for_build_wheel 'C:\Users\jared\AppData\Local\Temp\tmp7v6_n78r'
         cwd: C:\Users\jared\AppData\Local\Temp\pip-install-lx5mi3q7\f90wrap_9c5cd284e2024f75bb6e3eb831f8cdf3
    Complete output (84 lines):
    running egg_info
    running build_src
    build_src
    building extension "f90wrap.sizeof_fortran_t" sources
    f2py options: []
    f2py:> build\src.win32-3.9\f90wrap\sizeof_fortran_tmodule.c
    creating build
    creating build\src.win32-3.9
    creating build\src.win32-3.9\f90wrap
    Reading fortran codes...
        Reading file 'f90wrap/sizeoffortran.f90' (format:free)
    Post-processing...
        Block: sizeof_fortran_t
                        Block: sizeof_fortran_t
                                Block: ptr_type
    Post-processing (stage 2)...
    Building modules...
        Building module "sizeof_fortran_t"...
                Constructing wrapper function "sizeof_fortran_t"...
                  a = sizeof_fortran_t()
        Wrote C/API module "sizeof_fortran_t" to file "build\src.win32-3.9\f90wrap\sizeof_fortran_tmodule.c"
      adding 'build\src.win32-3.9\build\src.win32-3.9\f90wrap\fortranobject.c' to sources.
      adding 'build\src.win32-3.9\build\src.win32-3.9\f90wrap' to include_dirs.
    creating build\src.win32-3.9\build
    creating build\src.win32-3.9\build\src.win32-3.9
    creating build\src.win32-3.9\build\src.win32-3.9\f90wrap
    copying C:\Users\jared\AppData\Local\Temp\pip-build-env-l40if0hd\overlay\Lib\site-packages\numpy\f2py\src\fortranobject.c -> build\src.win32-3.9\build\src.win32-3.9\f90wrap
    copying C:\Users\jared\AppData\Local\Temp\pip-build-env-l40if0hd\overlay\Lib\site-packages\numpy\f2py\src\fortranobject.h -> build\src.win32-3.9\build\src.win32-3.9\f90wrap
    building extension "f90wrap.arraydata" sources
    build_src: building npy-pkg config files
    C:\Users\jared\AppData\Local\Temp\pip-build-env-l40if0hd\overlay\Lib\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
      warnings.warn(
    writing f90wrap.egg-info\PKG-INFO
    writing dependency_links to f90wrap.egg-info\dependency_links.txt
    writing requirements to f90wrap.egg-info\requires.txt
    writing top-level names to f90wrap.egg-info\top_level.txt
    C:\Users\jared\AppData\Local\Temp\pip-build-env-l40if0hd\overlay\Lib\site-packages\setuptools\command\egg_info.py:623: SetuptoolsDeprecationWarning: Custom 'build_py' does not implement 'get_data_files_without_manifest'.
    Please extend command classes from setuptools instead of distutils.
      warnings.warn(
    reading manifest file 'f90wrap.egg-info\SOURCES.txt'
    Traceback (most recent call last):
      File "C:\Users\jared\AppData\Local\Temp\tmpevpnxme0_in_process.py", line 363, in <module>
        main()
      File "C:\Users\jared\AppData\Local\Temp\tmpevpnxme0_in_process.py", line 345, in main
        json_out['return_val'] = hook(**hook_input['kwargs'])
      File "C:\Users\jared\AppData\Local\Temp\tmpevpnxme0_in_process.py", line 130, in get_requires_for_build_wheel
        return hook(config_settings)
      File "C:\Users\jared\AppData\Local\Temp\pip-build-env-l40if0hd\overlay\Lib\site-packages\setuptools\build_meta.py", line 177, in get_requires_for_build_wheel
        return self._get_build_requires(
      File "C:\Users\jared\AppData\Local\Temp\pip-build-env-l40if0hd\overlay\Lib\site-packages\setuptools\build_meta.py", line 159, in _get_build_requires
        self.run_setup()
      File "C:\Users\jared\AppData\Local\Temp\pip-build-env-l40if0hd\overlay\Lib\site-packages\setuptools\build_meta.py", line 174, in run_setup
        exec(compile(code, __file__, 'exec'), locals())
      File "setup.py", line 55, in <module>
        setup(name='f90wrap',
      File "C:\Users\jared\AppData\Local\Temp\pip-build-env-l40if0hd\overlay\Lib\site-packages\numpy\distutils\core.py", line 169, in setup
        return old_setup(**new_attr)
      File "C:\Users\jared\AppData\Local\Temp\pip-build-env-l40if0hd\overlay\Lib\site-packages\setuptools\__init__.py", line 155, in setup
        return distutils.core.setup(**attrs)
      File "C:\Users\jared\AppData\Local\Temp\pip-build-env-l40if0hd\overlay\Lib\site-packages\setuptools\_distutils\core.py", line 148, in setup
        return run_commands(dist)
      File "C:\Users\jared\AppData\Local\Temp\pip-build-env-l40if0hd\overlay\Lib\site-packages\setuptools\_distutils\core.py", line 163, in run_commands
        dist.run_commands()
      File "C:\Users\jared\AppData\Local\Temp\pip-build-env-l40if0hd\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 967, in run_commands
        self.run_command(cmd)
      File "C:\Users\jared\AppData\Local\Temp\pip-build-env-l40if0hd\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 986, in run_command
        cmd_obj.run()
      File "C:\Users\jared\AppData\Local\Temp\pip-build-env-l40if0hd\overlay\Lib\site-packages\numpy\distutils\command\egg_info.py", line 25, in run
        _egg_info.run(self)
      File "C:\Users\jared\AppData\Local\Temp\pip-build-env-l40if0hd\overlay\Lib\site-packages\setuptools\command\egg_info.py", line 298, in run
        self.find_sources()
      File "C:\Users\jared\AppData\Local\Temp\pip-build-env-l40if0hd\overlay\Lib\site-packages\setuptools\command\egg_info.py", line 305, in find_sources
        mm.run()
      File "C:\Users\jared\AppData\Local\Temp\pip-build-env-l40if0hd\overlay\Lib\site-packages\setuptools\command\egg_info.py", line 540, in run
        self.add_defaults()
      File "C:\Users\jared\AppData\Local\Temp\pip-build-env-l40if0hd\overlay\Lib\site-packages\setuptools\command\egg_info.py", line 584, in add_defaults
        self.read_manifest()
      File "C:\Users\jared\AppData\Local\Temp\pip-build-env-l40if0hd\overlay\Lib\site-packages\setuptools\command\sdist.py", line 195, in read_manifest
        self.filelist.append(line)
      File "C:\Users\jared\AppData\Local\Temp\pip-build-env-l40if0hd\overlay\Lib\site-packages\setuptools\command\egg_info.py", line 482, in append
        path = convert_path(item)
      File "C:\Users\jared\AppData\Local\Temp\pip-build-env-l40if0hd\overlay\Lib\site-packages\setuptools\_distutils\util.py", line 128, in convert_path
        raise ValueError("path '%s' cannot be absolute" % pathname)
    ValueError: path '/tmp/build-env-qdf9rfi1/lib/python3.9/site-packages/numpy/f2py/src/fortranobject.c' cannot be absolute

lewisjared avatar Mar 22 '22 14:03 lewisjared

Hello, I just ran in the same exact problem (Windows 10, MINGW-w64) with pip install f90wrap. Using pip install git+https://github.com/jameskermode/f90wrap worked fine.

christophe-david avatar Jul 20 '22 09:07 christophe-david

Ok, thanks for reporting. I’ll try to make a new release soon which should fix this issue.

jameskermode avatar Jul 20 '22 09:07 jameskermode

Well, the installation did not raise any error, but I got the same problem I always get with f2py on Windows: the DLL files are created in a .libs folder next to .pyd files, and Python complains with

ImportError: DLL load failed while importing sizeof_fortran_t: Le module spécifié est introuvable.

Simply moving manually the DLL file out of the .libs folder solves the issue. Which makes me realize that this issue has been updated since the last time I checked it out. Looks like there is now a real solution.

christophe-david avatar Jul 20 '22 09:07 christophe-david