BoothGroup / pygnme

Python interface to the libgnme package
7 stars 2 forks source link

Issues with CMake on Windows #1

Closed AAyati1 closed 1 year ago

AAyati1 commented 1 year ago

Hi, I'm trying to install pygnme but I get this error when I run "python -m pip install . -v --user" in the pygnme directory (I already have wheel installed):

Using pip 23.1.2 from C:\Users\aayati\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pip (python 3.10) Processing c:\users\aayati\onedrive - university of new brunswick\c-uhf\pygnme Running command python setup.py egg_info running egg_info creating C:\Users\aayati\AppData\Local\Temp\pip-pip-egg-info-08t4g38h\pygnme.egg-info writing C:\Users\aayati\AppData\Local\Temp\pip-pip-egg-info-08t4g38h\pygnme.egg-info\PKG-INFO writing dependency_links to C:\Users\aayati\AppData\Local\Temp\pip-pip-egg-info-08t4g38h\pygnme.egg-info\dependency_links.txt writing top-level names to C:\Users\aayati\AppData\Local\Temp\pip-pip-egg-info-08t4g38h\pygnme.egg-info\top_level.txt writing manifest file 'C:\Users\aayati\AppData\Local\Temp\pip-pip-egg-info-08t4g38h\pygnme.egg-info\SOURCES.txt' reading manifest file 'C:\Users\aayati\AppData\Local\Temp\pip-pip-egg-info-08t4g38h\pygnme.egg-info\SOURCES.txt' writing manifest file 'C:\Users\aayati\AppData\Local\Temp\pip-pip-egg-info-08t4g38h\pygnme.egg-info\SOURCES.txt' Preparing metadata (setup.py) ... done Building wheels for collected packages: pygnme Running command python setup.py bdist_wheel running bdist_wheel running build running build_py creating build creating build\lib.win-amd64-cpython-310 creating build\lib.win-amd64-cpython-310\pygnme copying pygnme__init__.py -> build\lib.win-amd64-cpython-310\pygnme running build_ext cmake "C:\Users\aayati\OneDrive - University of New Brunswick\C-UHF\pygnme" "-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\aayati\OneDrive - University of New Brunswick\C-UHF\pygnme\build\lib.win-amd64-cpython-310" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_RPATH=@ORIGIN -DPYTHON_EXECUTABLE=C:\Users\aayati\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\python.exe -- Building for: NMake Makefiles CMake Error at CMakeLists.txt:2 (project): Running

 'nmake' '-?'

failed with:

 The system cannot find the file specified

CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage -- Configuring incomplete, errors occurred! error: command 'C:\Program Files\CMake\bin\cmake.exe' failed with exit code 1 error: subprocess-exited-with-error

× python setup.py bdist_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: 'C:\Users\aayati\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\python.exe' -u -c ' exec(compile('"'"''"'"''"'"'

This is -- 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 = "" setup_py_code = "from setuptools import setup; setup()"

exec(compile(setup_py_code, filename, "exec")) '"'"''"'"''"'"' % ('"'"'C:\Users\aayati\OneDrive - University of New Brunswick\C-UHF\pygnme\setup.py'"'"',), "", "exec"))' bdist_wheel -d 'C:\Users\aayati\AppData\Local\Temp\pip-wheel-bi6jnr9a' cwd: C:\Users\aayati\OneDrive - University of New Brunswick\C-UHF\pygnme\ Building wheel for pygnme (setup.py) ... error ERROR: Failed building wheel for pygnme Running setup.py clean for pygnme Running command python setup.py clean running clean removing 'build\temp.win-amd64-cpython-310' (and everything under it) removing 'build\lib.win-amd64-cpython-310' (and everything under it) 'build\bdist.win-amd64' does not exist -- can't clean it 'build\scripts-3.10' does not exist -- can't clean it removing 'build' Failed to build pygnme ERROR: Could not build wheels for pygnme, which is required to install pyproject.toml-based projects

Hope you can help me resolve it.

Thanks

obackhouse commented 1 year ago

The formatting for your issue is a bit mangled so I might not be fully understanding, but it seems as though the issue is on importing setuptools - can you try pip install setuptools --user and try again?

I also haven't tested any of this on Windows, though I can't think of any specific reason why it wouldn't work unless libgnme doesn't support Windows (@hgaburton?).

AAyati1 commented 1 year ago

I tried pip install setuptools --user and I get: Requirement already satisfied. I tried again and I got the same error. Here is the same error message in a txt file error message.txt

obackhouse commented 1 year ago

If you don't mind, can you give me the output of pip freeze so that I can reproduce your environment, and I will try this on a windows machine tomorrow

AAyati1 commented 1 year ago

Sure, thank you! Here it is. pip freeze.txt

obackhouse commented 1 year ago

Sorry for the delay, I did not have access to a windows machine - can you try to add '-DCMAKE_GENERATOR=<option>' to this list? For <option> use either "Virtual Studio" if you're using vscode, or another generator if not such as "MinGW Makefiles".

obackhouse commented 1 year ago

hmm, seems like if I use "-G \"Visual Studio 17 2022\"" instead it accepts the argument but then says that the generator doesn't exist even though it's in the list. I have zero developing experience in windows. Does this get you anywhere?