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

Having problems with compile.cmd #149

Open
adgelt opened this issue May 26, 2024 · 14 comments
Open

Having problems with compile.cmd #149

adgelt opened this issue May 26, 2024 · 14 comments

Comments

@adgelt
Copy link

adgelt commented May 26, 2024

I'm getting this issue of not finding the python311.dll in the folder but upon checking there is existing file. What could be the problem?

Looking for python311.dll
INFO: Building import library (arch=AMD64): "C:\Users\Gelo\libs\libpython311.a" (from C:\Users\Gelo\python311.dll)
error: [WinError 2] The system cannot find the file specified

Screenshot 2024-05-26 231715

@wcarthur
Copy link
Member

At present, we haven't built against Python 3.11 on Windows environment, so unsure what may be the cause. If you could provide additional info such as operating system, python version, what package manager you're using (e.g. conda, pip, virtualenv), we may be able to assist.

@adgelt
Copy link
Author

adgelt commented Jun 24, 2024

At present, we haven't built against Python 3.11 on Windows environment, so unsure what may be the cause. If you could provide additional info such as operating system, python version, what package manager you're using (e.g. conda, pip, virtualenv), we may be able to assist.

Hello, I'm using Windows 11 as OS, and tried installing the code using pip. What could be the problem?

@adgelt adgelt closed this as completed Jun 24, 2024
@adgelt adgelt reopened this Jun 24, 2024
@adgelt
Copy link
Author

adgelt commented Jun 24, 2024

Hello, I'm using Windows 11 as OS, and tried installing the code using pip. What could be the problem?

@wcarthur
Copy link
Member

wcarthur commented Jul 2, 2024

This still uses an older build method for the FORTRAN extension packages (wind.windmodels, etc.), which is the likely culprit of the error you're seeing. There is a bit of additional complexity in the existing setup.py script that we can do away with (the py2exe components haven't been used in a long time) - I'll take a look at what's needed to update to the newer build systems:

https://packaging.python.org/en/latest/guides/modernize-setup-py-project/

EDIT: Also worth pointing out that you don't need to compile these extensions to run the model. The FORTRAN versions enable a speedup over the pure python implementations (except for akima) which are included.

@adgelt
Copy link
Author

adgelt commented Aug 13, 2024

What versions of Python and other extension packages should I be using for the compile.cmd to work?

@wcarthur
Copy link
Member

I've made an attempt to build on Windows x86-64 using MinGW-w64, Python 3.11, and can't get it to build, having tried a number of strategies. Some investigation suggested that there's an issue with MinGW-w64 interacting with the python311.dll.

Rolling back to Python 3.10 is one suggested workaround. In the meantime, I'll continue to work on the package build for the next updates.

@adgelt
Copy link
Author

adgelt commented Aug 26, 2024

What do you think is causing this error?
image

@wcarthur
Copy link
Member

Since Python 3.11, the unittest package droopped support for namespace packages. This means the unittests will only discover tests if there's a __init__.py file in the directory. Presently there's no __init__.py file in the tests directory so the unitttest package cannot discover the suite of tests.
There's two options:

  1. create an empty file called __init__.py in the tests directory. This will enabpe run_test_all.cmd to discover the tests.
  2. use pytest -x to run the tests (this will become the preferred option in future releases). pytest is listed in the tcrmenv.yml file as a dependency.

Note: on Windows platforms, running the tests may generate PermissionError messages:

Traceback (most recent call last):
    File "C:\W10Dev\Anaconda3\envs\tcrm\Lib\shutil.py", line 634, in _rmtree_unsafe
      os.unlink(fullname)
  PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\\Users\\blah\\AppData\\Local\\Temp\\tmp_xy80wsa\\windfield\\gust.001-00001.nc'

  During handling of the above exception, another exception occurred:

  Traceback (most recent call last):
    File "C:\W10Dev\Anaconda3\envs\tcrm\Lib\weakref.py", line 590, in __call__
      return info.func(*info.args, **(info.kwargs or {}))
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\W10Dev\Anaconda3\envs\tcrm\Lib\tempfile.py", line 935, in _cleanup
      cls._rmtree(name, ignore_errors=ignore_errors)
    File "C:\W10Dev\Anaconda3\envs\tcrm\Lib\tempfile.py", line 930, in _rmtree
      _shutil.rmtree(name, onexc=onexc)
    File "C:\W10Dev\Anaconda3\envs\tcrm\Lib\shutil.py", line 808, in rmtree
      return _rmtree_unsafe(path, onexc)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\W10Dev\Anaconda3\envs\tcrm\Lib\shutil.py", line 631, in _rmtree_unsafe
      _rmtree_unsafe(fullname, onexc)
    File "C:\W10Dev\Anaconda3\envs\tcrm\Lib\shutil.py", line 636, in _rmtree_unsafe
      onexc(os.unlink, fullname, err)
    File "C:\W10Dev\Anaconda3\envs\tcrm\Lib\tempfile.py", line 905, in onexc
      _os.unlink(path)
  PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\\Users\\blah\\AppData\\Local\\Temp\\tmp_xy80wsa\\windfield\\gust.001-00001.nc'

This is because the operating system tries to remove the temporary files while the process is still running. These errors can be ignored.

@adgelt
Copy link
Author

adgelt commented Aug 26, 2024

after using the pytest -x this is what I got. I'm not sure on what it means.
image

@wcarthur
Copy link
Member

Can you show the output of the following command:

echo %PYTHONPATH%

In my case, it lists the tcrm and tcrm/Utilities directories. Also check that NumpyTestCase.py exists in the tests directory.

@adgelt
Copy link
Author

adgelt commented Aug 26, 2024

This is my PYTHONPATH
image

NumpyTestCase.py is in my test directory.

Also tried the __init__.py and a lot of error popped out like this
image

I found out that array is being imported from scipy in the NumpyTestCase.py which is supposed to be from numpy.

@adgelt
Copy link
Author

adgelt commented Aug 26, 2024

Also, how do you resolve this type of warning?
image

@wcarthur
Copy link
Member

wcarthur commented Aug 26, 2024

Also, how do you resolve this type of warning? image

This can safely be ignored - see earlier comment about these FORTRAN extension packages.

@wcarthur
Copy link
Member

This is my PYTHONPATH image

NumpyTestCase.py is in my test directory.

Also tried the __init__.py and a lot of error popped out like this image

I found out that array is being imported from scipy in the NumpyTestCase.py which is supposed to be from numpy.

I have no such issues (scipy 1.11.3) - may be worth checking scipy version installed

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

No branches or pull requests

2 participants