-
-
Notifications
You must be signed in to change notification settings - Fork 33
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
nimporter can't find file on Windows 10 #75
Comments
This works beautifully on Linux, but returns the "system cannot find the file specified" error on Windows 10. I've tried it on 2 different Windows 10 laptops, so I don't think it's anything specific to the laptop setup. |
Hi @davidcsisk , can you confirm what C compilers you have installed along with arch info? |
Hi @Pebaz ...please let me know if there's any other info you need, or commands I should run to gather info to post. C:\Users\david>nim --version active boot switches: -d:release The only C compiler is the default mingw64.7z that's installed with nim, which works fine for nim-only apps. |
Hi @davidcsisk , I think this error occurs when the compilers do not match. Can you confirm if you are using any of these:
My guess in this case is that Python was compiled for MSVC but Nim tries to use MingW (incompatible compilers). You can make sure by doing: Let me know how it goes 🙂 |
Hello, I'm facing this same issue. I'm not an expert on these MSVC/MingW that you're talking about I quite did not understand this:
Are you saying that there's an MSVC version of Python? If so, how can i download it? Because I don't see anything mentioned about MSC or MSVC in python.org website. |
Hi @scrazzz, no worries, the goal here is to make the C compiler used to compile Python match the C compiler used to compile the C output from Nim. For instance, if your |
@Pebaz Thanks for the quick reply! I do have Microsoft Visual C++ compiler installed. What's the next step? |
Hi...I'm not sure I fully understand the question. @Pebaz , here's my output: C:\Users\david>python --version No MSVC mentioned. Does this get you what you needed? If not, please post the commands that you want me to run to display the relevant info, and I'll be more than happy to do that. Thanks and regards, |
@davidcsisk |
@davidcsisk As scrazzz mention |
Shoot sorry, my bad yeah opening the prompt is usually how I check that (made a bad guess). Thanks @mukherjee for the alternate way of checking. @davidcsisk have you had an opportunity to run that command? We should be able to get to the bottom of this, I’ve seen this sort of issue happen a lot during project setup but let’s figure it out 😀 |
Closing this for now but if anyone still needs help with dev env setup let me know. |
Here is a working example to reproduce the problem:
C:\Users\dave.sisk\math_speedup_example>type pmath.py
def fib(n):
if n == 0:
return 0
elif n < 3:
return 1
return fib(n - 1) + fib(n - 2)
C:\Users\dave.sisk\math_speedup_example>type nmath.nim
import nimpy
proc fib(n: int): int {.exportpy.} =
if n == 0:
return 0
elif n < 3:
return 1
return fib(n-1) + fib(n-2)
C:\Users\dave.sisk\math_speedup_example>type main.py
import nimporter
from time import perf_counter
import nmath # Nim imports!
import pmath
print('Measuring Python...')
start_py = perf_counter()
for i in range(0, 40):
print(pmath.fib(i), end=" ")
end_py = perf_counter()
print('\n\nMeasuring Nim...')
start_nim = perf_counter()
for i in range(0, 40):
print(nmath.fib(i), end=" ")
end_nim = perf_counter()
print('\n---------')
print('Python Elapsed: {:.2f}'.format(end_py - start_py))
print('Nim Elapsed: {:.2f}'.format(end_nim - start_nim))
C:\Users\dave.sisk\math_speedup_example>python main.py
Traceback (most recent call last):
File "C:\Users\dave.sisk\math_speedup_example\main.py", line 3, in
import nmath # Nim imports!
File "", line 1027, in _find_and_load
File "", line 1002, in _find_and_load_unlocked
File "", line 945, in _find_spec
File "C:\Users\dave.sisk\AppData\Local\Programs\Python\Python310\lib\site-packages\nimporter.py", line 1269, in find_spec
return Nimporter.import_nim_code(fullname, path, library=False)
File "C:\Users\dave.sisk\AppData\Local\Programs\Python\Python310\lib\site-packages\nimporter.py", line 944, in import_nim_code
NimCompiler.compile_nim_code(
File "C:\Users\dave.sisk\AppData\Local\Programs\Python\Python310\lib\site-packages\nimporter.py", line 705, in compile_nim_code
cls.check_compile_errors(errors, library, nim_args, output, tmp_cwd, warnings)
File "C:\Users\dave.sisk\AppData\Local\Programs\Python\Python310\lib\site-packages\nimporter.py", line 492, in check_compile_errors
raise NimCompileException(errors[0])
nimporter.NimCompileException: Error: unhandled exception: The system cannot find the file specified.
The text was updated successfully, but these errors were encountered: