I’m writing a (really janky) 2d fluid simulation in Python. Currently I’m generating a starting state for the sim by just filling a 2d array with random floats generated by the random
module, and then blurring the texture by averaging each cell with the ones around it. This is very slow, and produces a noise texture that’s somewhat blocky due to the square blur shape. So once I got bored of waiting for ten seconds every now and then for python to generate a new random grid, I decided to invest what I thought would be a mere ten minutes into figuring out how to use a library for it. Five hours later, I find myself exactly where I started, just more frustrated. I’ve been trying to install this package using the command pip install noise
, but every time I try the command the same error comes back, even after trying every other fix for similar problems I could find. The error looks like this:
Defaulting to user installation because normal site-packages is not writeable
Collecting noise
Using cached noise-1.2.2.zip (132 kB)
Preparing metadata (setup.py) ... done
Building wheels for collected packages: noise
Building wheel for noise (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [31 lines of output]
running bdist_wheel
running build
running build_py
creating build
creating buildlib.win32-cpython-312
creating buildlib.win32-cpython-312noise
copying perlin.py -> buildlib.win32-cpython-312noise
copying shader.py -> buildlib.win32-cpython-312noise
copying shader_noise.py -> buildlib.win32-cpython-312noise
copying test.py -> buildlib.win32-cpython-312noise
copying __init__.py -> buildlib.win32-cpython-312noise
running build_ext
building 'noise._simplex' extension
creating buildtemp.win32-cpython-312
creating buildtemp.win32-cpython-312Release
"C:Program FilesMicrosoft Visual Studio2022CommunityVCToolsMSVC14.36.32532binHostX86x86cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD "-IC:Program FilesWindowsAppsPythonSoftwareFoundation.Python.3.12_3.12.1008.0_x64__qbz5n2kfra8p0include" "-IC:Program FilesWindowsAppsPythonSoftwareFoundation.Python.3.12_3.12.1008.0_x64__qbz5n2kfra8p0Include" "-IC:Program FilesMicrosoft Visual Studio2022CommunityVCToolsMSVC14.36.32532include" "-IC:Program FilesMicrosoft Visual Studio2022CommunityVCAuxiliaryVSinclude" "-IC:Program Files (x86)Windows Kits10include10.0.22000.0ucrt" "-IC:Program Files (x86)Windows Kits10\include10.0.22000.0\um" "-IC:Program Files (x86)Windows Kits10\include10.0.22000.0\shared" "-IC:Program Files (x86)Windows Kits10\include10.0.22000.0\winrt" "-IC:Program Files (x86)Windows Kits10\include10.0.22000.0\cppwinrt" "-IC:Program Files (x86)Windows KitsNETFXSDK4.8includeum" "-IC:Program FilesMicrosoft Visual Studio2022CommunityVCToolsMSVC14.36.32532include" "-IC:Program FilesMicrosoft Visual Studio2022CommunityVCAuxiliaryVSinclude" "-IC:Program Files (x86)Windows Kits10include10.0.22000.0ucrt" "-IC:Program Files (x86)Windows Kits10\include10.0.22000.0\um" "-IC:Program Files (x86)Windows Kits10\include10.0.22000.0\shared" "-IC:Program Files (x86)Windows Kits10\include10.0.22000.0\winrt" "-IC:Program Files (x86)Windows Kits10\include10.0.22000.0\cppwinrt" "-IC:Program Files (x86)Windows KitsNETFXSDK4.8includeum" /Tc_simplex.c /Fobuildtemp.win32-cpython-312Release_simplex.obj
_simplex.c
_simplex.c(235): warning C4244: 'return': conversion from 'double' to 'float', possible loss of data
_simplex.c(296): warning C4244: 'initializing': conversion from 'double' to 'float', possible loss of data
_simplex.c(297): warning C4244: 'initializing': conversion from 'double' to 'float', possible loss of data
_simplex.c(308): warning C4244: 'initializing': conversion from 'double' to 'float', possible loss of data
_simplex.c(309): warning C4244: 'initializing': conversion from 'double' to 'float', possible loss of data
"C:Program FilesMicrosoft Visual Studio2022CommunityVCToolsMSVC14.36.32532binHostX86x86link.exe" /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO "/LIBPATH:C:Program FilesWindowsAppsPythonSoftwareFoundation.Python.3.12_3.12.1008.0_x64__qbz5n2kfra8p0libs" "/LIBPATH:C:Program FilesWindowsAppsPythonSoftwareFoundation.Python.3.12_3.12.1008.0_x64__qbz5n2kfra8p0" "/LIBPATH:C:Program FilesWindowsAppsPythonSoftwareFoundation.Python.3.12_3.12.1008.0_x64__qbz5n2kfra8p0PCbuildwin32" "/LIBPATH:C:Program FilesMicrosoft Visual Studio2022CommunityVCToolsMSVC14.36.32532libx86" "/LIBPATH:C:Program Files (x86)Windows KitsNETFXSDK4.8libumx86" "/LIBPATH:C:Program Files (x86)Windows Kits10lib10.0.22000.0ucrtx86" "/LIBPATH:C:Program Files (x86)Windows Kits10\lib10.0.22000.0\umx86" "/LIBPATH:C:Program FilesMicrosoft Visual Studio2022CommunityVCToolsMSVC14.36.32532libx86" "/LIBPATH:C:Program Files (x86)Windows KitsNETFXSDK4.8libumx86" "/LIBPATH:C:Program Files (x86)Windows Kits10lib10.0.22000.0ucrtx86" "/LIBPATH:C:Program Files (x86)Windows Kits10\lib10.0.22000.0\umx86" /EXPORT:PyInit__simplex buildtemp.win32-cpython-312Release_simplex.obj /OUT:buildlib.win32-cpython-312noise_simplex.cp312-win_amd64.pyd /IMPLIB:buildtemp.win32-cpython-312Release_simplex.cp312-win_amd64.lib
Creating library buildtemp.win32-cpython-312Release_simplex.cp312-win_amd64.lib and object buildtemp.win32-cpython-312Release_simplex.cp312-win_amd64.exp
_simplex.obj : error LNK2001: unresolved external symbol __imp__PyFloat_FromDouble
_simplex.obj : error LNK2001: unresolved external symbol __imp__PyErr_SetString
_simplex.obj : error LNK2001: unresolved external symbol __imp__PyExc_ValueError
_simplex.obj : error LNK2001: unresolved external symbol __imp__PyModule_Create2
_simplex.obj : error LNK2001: unresolved external symbol __imp__PyArg_ParseTupleAndKeywords
buildlib.win32-cpython-312noise_simplex.cp312-win_amd64.pyd : fatal error LNK1120: 5 unresolved externals
error: command 'C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\bin\HostX86\x86\link.exe' failed with exit code 1120
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for noise
Running setup.py clean for noise
Failed to build noise
ERROR: Could not build wheels for noise, which is required to install pyproject.toml-based projects
I’ve tried updating wheel, setuptools, Cmake, pip, Python, and even PowerShell to no avail. I’ve added all the python-related dirs to PATH
as well. Nothing has worked, I still get the same error.
2
Answers
From the solver settings I see that there is a noise package dependency installed that could potentially have been compiled in a wrong manner. There are still some link-time undefined references to functions in the python library and system which led to the following error messages. This may be due to a number of reasons, such as, some missing dependencies or presence of different version of a compiler. One possible fix for all the issues highlighted above is the installation of the item from a pre-built binary rather than compiling it from source. To do this make sure that the package version that you are specifying corresponds to the Python version and Operating System that will be used. If this is not possible, you could always use earlier version of the package which can potentially be better for use in your cases.
The package you are trying to install contains
C
code and thus needs to be compiled.You have an issue with your toolchain though:
You are using a x86 compiler/linker, see
HostX86x86cl.exe
and...HostX86x86link.exe
– make sure that you have a 64 bit python and that you executeC:Program FilesMicrosoft Visual Studio2022CommunityVCAuxiliaryBuildvcvars64.bat
before attempting yourpip install
Apart from that, you might have compatibility issues:
The library you are trying to install was last updated in 2015. It looks to me like the missing symbols should be present in python 3.12 as well, but no guarantee that installing to this python version will work without issue. If, after making sure you are compiling for x64 you still have issues, try to downgrade python to a lower version