juancarlospaco / faster-than-csv

Faster CSV for Python
https://juancarlospaco.github.io/faster-than-csv
MIT License
99 stars 8 forks source link

Pip install error - Syntax error in `faster_than_csv.nim.c` #7

Closed GillesC closed 4 years ago

GillesC commented 4 years ago

Platform: Windows 10 (64-bit) Python version: 3.8

pip install faster_than_csv --isolated --disable-pip-version-check --no-cache-dir --no-binary :all:
Collecting faster_than_csv
  Downloading faster_than_csv-0.9.zip (181 kB)
     |████████████████████████████████| 181 kB 3.3 MB/s
Installing collected packages: faster-than-csv
    Running setup.py install for faster-than-csv ... error
    ERROR: Command errored out with exit status 1:
     command: 'c:\users\calle\documents\github\marrmot\.venv\scripts\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Calle\\AppData\\Local\\Temp\\pip-install-csfhbi4j\\faster-than-csv\\setup.py'"'"'; __file__='"'"'C:\\Users\\Calle\\AppData\\Local\\Temp\\pip-install-csfhbi4j\\faster-than-csv\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' --no-user-cfg install --record 'C:\Users\Calle\AppData\Local\Temp\pip-record-3q3bot33\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\calle\documents\github\marrmot\.venv\include\site\python3.8\faster-than-csv'
         cwd: C:\Users\Calle\AppData\Local\Temp\pip-install-csfhbi4j\faster-than-csv\
    Complete output (24 lines):
    running install
    running build
    running build_ext
    building 'faster_than_csv' extension
    creating build
    creating build\temp.win-amd64-3.8
    creating build\temp.win-amd64-3.8\Release
    C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -I. -Ic:\users\calle\documents\github\marrmot\.venv\include -IC:\Users\Calle\AppData\Local\Programs\Python\Python38\include -IC:\Users\Calle\AppData\Local\Programs\Python\Python38\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt" /Tcfaster_than_csv.nim.c /Fobuild\temp.win-amd64-3.8\Release\faster_than_csv.nim.obj -flto -ffast-math -march=native -mtune=native -O3 -fno-ident -fsingle-precision-constant
    cl : Command line warning D9002 : ignoring unknown option '-flto'
    cl : Command line warning D9002 : ignoring unknown option '-ffast-math'
    cl : Command line warning D9002 : ignoring unknown option '-march=native'
    cl : Command line warning D9002 : ignoring unknown option '-mtune=native'
    cl : Command line warning D9002 : ignoring unknown option '-O3'
    cl : Command line warning D9002 : ignoring unknown option '-fno-ident'
    cl : Command line warning D9002 : ignoring unknown option '-fsingle-precision-constant'
    faster_than_csv.nim.c
    faster_than_csv.nim.c(2985): error C2143: syntax error: missing ')' before '('
    faster_than_csv.nim.c(2985): error C2059: syntax error: ')'
    faster_than_csv.nim.c(2985): error C2146: syntax error: missing ')' before identifier 'NimMainInit'
    faster_than_csv.nim.c(2985): error C2091: function returns function
    faster_than_csv.nim.c(2985): error C2061: syntax error: identifier 'NimMainInit'
    faster_than_csv.nim.c(2985): error C2059: syntax error: ';'
    faster_than_csv.nim.c(2985): error C2059: syntax error: '<parameter-list>'
    error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools\\VC\\Tools\\MSVC\\14.16.27023\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\calle\documents\github\marrmot\.venv\scripts\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Calle\\AppData\\Local\\Temp\\pip-install-csfhbi4j\\faster-than-csv\\setup.py'"'"'; __file__='"'"'C:\\Users\\Calle\\AppData\\Local\\Temp\\pip-install-csfhbi4j\\faster-than-csv\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' --no-user-cfg install --record 'C:\Users\Calle\AppData\Local\Temp\pip-record-3q3bot33\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\calle\documents\github\marrmot\.venv\include\site\python3.8\faster-than-csv' Check the logs for full command output.
juancarlospaco commented 4 years ago

https://github.com/juancarlospaco/faster-than-csv/blob/master/README.md#windows

GillesC commented 4 years ago

Allright, the readme is not really noob-friendly. I'll try to make a PR based on the experience of installing and building your Nim project.

juancarlospaco commented 4 years ago

That may be true, but check the GitHub Actions, it builds from scratch step by step on every push, and they wont use any very advanced OS specific tools, just Git, Curl, etc you can get Windows version of those too. Besides that, most people is using Docker nowadays.

We expand functionality and readme as time goes, some stuff has been requested by people on the past. :slightly_smiling_face:

GillesC commented 4 years ago

I installed nim. I executed : nim c --hint[Processing]:off --app:lib --out:faster_than_csv.dll faster_than_csv.nim So now I have a *.dllfile. How can I now use the generated file in Python?

juancarlospaco commented 4 years ago

Not *.dll, must be *.pyd, readme says that.

GillesC commented 4 years ago

Not *.dll, must be *.pyd, readme says that.

Yeah OK, but the screenshot shows something else.

juancarlospaco commented 4 years ago

*.pyd can be just imported, put it on the same folder as the *.py and is ready. Example folder has examples, also requested by people.

GillesC commented 4 years ago

I compiled from source as:

nim c --app:lib --threads:on --out:faster_than_csv.pyd src/faster_than_csv.nim
Hint: used config file 'C:\Users\Calle\scoop\apps\nim\current\config\nim.cfg' [Conf]
Hint: used config file 'C:\Users\Calle\Downloads\faster-than-csv-master\faster-than-csv-master\src\faster_than_csv.nim.cfg' [Conf]
Hint: system [Processing]
Hint: widestrs [Processing]
Hint: io [Processing]
Hint: faster_than_csv [Processing]
Hint: parsecsv [Processing]
Hint: lexbase [Processing]
Hint: strutils [Processing]
Hint: parseutils [Processing]
Hint: math [Processing]
Hint: bitops [Processing]
Hint: macros [Processing]
Hint: algorithm [Processing]
Hint: unicode [Processing]
Hint: streams [Processing]
Hint: json [Processing]
Hint: hashes [Processing]
Hint: tables [Processing]
Hint: parsejson [Processing]
Hint: options [Processing]
Hint: typetraits [Processing]
Hint: os [Processing]
Hint: pathnorm [Processing]
Hint: osseps [Processing]
Hint: winlean [Processing]
Hint: dynlib [Processing]
Hint: times [Processing]
Hint: time_t [Processing]
Hint: osproc [Processing]
Hint: strtabs [Processing]
Hint: cpuinfo [Processing]
Hint: xmltree [Processing]
Hint: punycode [Processing]
Hint: httpclient [Processing]
Hint: net [Processing]
Hint: nativesockets [Processing]
Hint: sets [Processing]
Hint: monotimes [Processing]
Hint: openssl [Processing]
Hint: uri [Processing]
Hint: base64 [Processing]
Hint: mimetypes [Processing]
Hint: random [Processing]
Hint: httpcore [Processing]
Hint: asyncnet [Processing]
Hint: asyncdispatch [Processing]
Hint: heapqueue [Processing]
Hint: lists [Processing]
Hint: asyncstreams [Processing]
Hint: asyncfutures [Processing]
Hint: deques [Processing]
Hint: cstrutils [Processing]
Hint: asyncfile [Processing]
Hint: diff [Processing]
Hint: nimpy [Processing]
Hint: complex [Processing]
Hint: py_types [Processing]
Hint: py_utils [Processing]
Hint: py_lib [Processing]
Hint: sequtils [Processing]
Hint:  [Link]
Hint: operation successful (94891 lines compiled; 3.732 sec total; 110.906MiB peakmem; Dangerous Release Build) [SuccessX]

And added the DLLs (they were already there). However, when importing the .pyd, I get the following: could not load: (libcrypto-1_1-x64|libeay64).dll.

GillesC commented 4 years ago

Reinstalling OpenSSL worked. So in the end it is more than 2 lines of codes.

Thank you.

juancarlospaco commented 4 years ago

Great, yes is kinda not too complicated, you learn something new today, yes usually the DLL are already there too, you solved problem pretty quickly. :slightly_smiling_face: