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

Install pycurl on windows #657

Closed
Eziodeng opened this issue Sep 26, 2020 · 38 comments
Closed

Install pycurl on windows #657

Eziodeng opened this issue Sep 26, 2020 · 38 comments

Comments

@Eziodeng
Copy link

Eziodeng commented Sep 26, 2020

What happened?

Recently I want to install pycurl, but i met a problem when I use pip install pycurl and it infomationed that 'Please specify --curl-dir'. But when I read setup.py I find out what you have written in this file that 'Windows users have to pass --curl-dir parameter', how I should do to pass that parameter? By using '#' where this parameter appear?

What is the PycURL version?

7.43.0.6(acturally most recent version of pycurl unless using whl to install

What is your Python version?

3.8.1

What is your operating system and its version?

Microsoft Windows 10 profrssional

@p
Copy link
Member

p commented Oct 8, 2020

I have not built windows binaries for the most recent release, you need to install from source or someone can contribute the binaries.

@sla-te
Copy link

sla-te commented Dec 14, 2020

Yeah, tried everything myself, cant get this installed, not with pip nor easy_install.

@twangboy
Copy link

@p Your documentation states that As of version 7.43.0, PycURL provides binary wheels for Windows. Is this no longer the case? Is there a reason why these are not longer being provided?

Are there instructions for how to build a whl file for pycurl?

@p
Copy link
Member

p commented Apr 15, 2021

If you'd like to submit a PR removing that language I'll merge it.

The reason I haven't done windows builds is they require a significant time to produce for each release.

If you want to tackle this, start with http://pycurl.io/docs/latest/install.html#building-from-source.

@p
Copy link
Member

p commented May 27, 2021

Per #678 the winbuild code seems to have gotten broken at some point.

@naveen521kk
Copy link

naveen521kk commented Sep 15, 2021

Would it be fine to build wheels of Github Actions and publish it to PyPI rather than generating manually? I would like to help :).

@p
Copy link
Member

p commented Jan 11, 2022

@naveen521kk This was attempted at some point however the CI dependencies were used which were fixed (i.e. outdated) versions. To build releases all of the dependencies need to be current.

If you or anyone wishes to tackle this project, I suggest starting with getting the builds working locally on windows because that is a whole endeavor in itself and without understanding that I don't think you'll be successful in producing release-level builds.

@naveen521kk
Copy link

Thanks for the reply. When posting that comment I was successful in getting the wheel built working locally and on Github Actions, I just wanted to know if the contribution would be accepted. At that time this project didn't compile with Python 3.9, but it does now, so I'll need to add that also.

I would rebase that branch and will make a PR for review.

@naveen521kk
Copy link

naveen521kk commented Jan 12, 2022

Rebasing made the wheel built fail or rather pycurl doesn't build with MSVC

src\easy.c(87): error C2078: too many initializers
src\easy.c(30): error C2078: too many initializers
src\easy.c(174): error C2078: too many initializers
src\easy.c(117): error C2078: too many initializers
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\cl.exe' failed with exit status 2

Edit: StackOverflow gets me to https://stackoverflow.com/questions/26563603/too-many-initializers-for-array-in-c

@gvanem
Copy link
Contributor

gvanem commented Jan 12, 2022

@naveen521kk The easy.c code is wrong for Python 3.0 - 3.7. But easy to fix though:

--- a/src/easy.c 2022-01-12 11:10:18
+++ b/src/easy.c 2022-01-12 11:38:01
@@ -78,7 +78,7 @@
     0,                          /* tp_cache */
     0,                          /* tp_subclasses */
     0,                          /* tp_weaklist */
-#if PY_MAJOR_VERSION >= 3
+#if PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 8
     0,                          /* tp_del */
     0,                          /* tp_version_tag */
     0,                          /* tp_finalize */
@@ -165,7 +165,7 @@
     0,                          /* tp_cache */
     0,                          /* tp_subclasses */
     0,                          /* tp_weaklist */
-#if PY_MAJOR_VERSION >= 3
+#if PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 8
     0,                          /* tp_del */
     0,                          /* tp_version_tag */
     0,                          /* tp_finalize */

Ref: https://www.python.org/dev/peps/pep-0590/

@p Please fix this.

@p
Copy link
Member

p commented Jan 12, 2022

I am happy to merge a PR with that fix if it passes CI.

@iamahmedshahh
Copy link

Git Installed
Curl Installed
Path Added
When i try to install pycurl this is what i get (I am installing pycurl via git)

× python setup.py egg_info did not run successfully. │ exit code: 10 ╰─> [1 lines of output] Please specify --curl-dir=/path/to/built/libcurl [end of output]
This seems like a path problem but I have already added paths in the env variable as follows

C:\Windows\System32\curl.exe
C:\curl\bin\curl.exe
C:\Windows\SysWOW64\curl.exe

@swt2c
Copy link
Contributor

swt2c commented Apr 12, 2022

Git Installed Curl Installed Path Added When i try to install pycurl this is what i get (I am installing pycurl via git)

× python setup.py egg_info did not run successfully. │ exit code: 10 ╰─> [1 lines of output] Please specify --curl-dir=/path/to/built/libcurl [end of output] This seems like a path problem but I have already added paths in the env variable as follows

C:\Windows\System32\curl.exe C:\curl\bin\curl.exe C:\Windows\SysWOW64\curl.exe

As noted in the error message, you need to use the --curl-dir argument to specify the path to libcurl not curl.exe.

@iamahmedshahh
Copy link

I used that argument as well, doesn't work my curl folder has does not have this folder built/libcurl

@jafrmartins
Copy link

image

This happens when i try to install pycurl on windows using pip...do you have plans for supporting windows install via PIP?

@jdai
Copy link

jdai commented Sep 1, 2022

I got similar error as [jafrmartins], no solution? is there a released .exe can run on windows?

@Alex-ley-scrub
Copy link

You could try these unofficial pre-built Windows wheels: https://www.lfd.uci.edu/~gohlke/pythonlibs/#pycurl
I've used them for things like PyICU, pycld2, GDAL, Fiona, and pycurl. Works well but use at your own risk / your milage my vary.
e.g. something like this but change the cp39 for your version of CPython and the correct win32 or win_amd64 value.

pip install https://download.lfd.uci.edu/pythonlibs/archived/pycurl-7.45.1-cp39-cp39-win_amd64.whl

@jdai
Copy link

jdai commented Sep 6, 2022

Alex thanks this works!

@AAC-Coder
Copy link

You could try these unofficial pre-built Windows wheels: https://www.lfd.uci.edu/~gohlke/pythonlibs/#pycurl I've used them for things like PyICU, pycld2, GDAL, Fiona, and pycurl. Works well but use at your own risk / your milage my vary. e.g. something like this but change the cp39 for your version of CPython and the correct win32 or win_amd64 value.

pip install https://download.lfd.uci.edu/pythonlibs/archived/pycurl-7.45.1-cp39-cp39-win_amd64.whl

Thank you very much and more power

@StalKlim
Copy link

You could try these unofficial pre-built Windows wheels: https://www.lfd.uci.edu/~gohlke/pythonlibs/#pycurl I've used them for things like PyICU, pycld2, GDAL, Fiona, and pycurl. Works well but use at your own risk / your milage my vary. e.g. something like this but change the cp39 for your version of CPython and the correct win32 or win_amd64 value.

pip install https://download.lfd.uci.edu/pythonlibs/archived/pycurl-7.45.1-cp39-cp39-win_amd64.whl

Thank you so much for the clarification, your comment was very helpful!

@p
Copy link
Member

p commented Feb 25, 2023

Last I checked I couldn't find the documentation for how to build binary wheels. Locating it would be a good start.

@SMcCandlish
Copy link

Any other solutions? I still get this "Please specify --curl-dir=/path/to/built/libcurl" problem, when running pip install --pre pyload-ng[all], and pip supports no --curl-dir= parameter (the underlying python executable does so). In the interim, the lfd.uci.edu repos above are gone.

@SMcCandlish
Copy link

SMcCandlish commented Feb 7, 2024

PS: Trying to follow tips on another page, I installed curl via Chocolatey, and then I did this:

cd "C:\Users\USERNAME\Downloads\pyLoad\pyload\dist\module
python setup.py --curl-dir="C:\ProgramData\chocolatey\lib\curl\tools\curl-8.6.0_1-win64-mingw\lib" --use-libcurl-dll

using the (rather redundant) path of the curl libraries installed by choco. That just gave this error:

File "C:\Users\USERNAME\Downloads\pyLoad\pyLoad\dist\module\setup.py", line 66
print ""
^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?

So, I just give up for now. This is geekier than I know what to do with, at least in Windows. Linux or MacOS, I would bang on it further.

@gvanem
Copy link
Contributor

gvanem commented Feb 7, 2024

What is pyLoad?

print ""
^^^^^^^^

Easy to fix though. print ("") etc.

@swt2c
Copy link
Contributor

swt2c commented Feb 7, 2024

If you're just interested in unofficial Windows wheels built by our CI, you can just download them here (this is the latest run):
https://github.com/pycurl/pycurl/actions/runs/7633843580

Click on Artifacts.

@SMcCandlish
Copy link

SMcCandlish commented Feb 8, 2024

Wouldn't know what to do with it. What I'm trying to do is get pycurl to install in Windows.

I run:
pip install --pre cpython[all]
and I get an error reading
Getting requirements to build wheel did not run successfully.
│ exit code: 10
╰─> [1 lines of output]
Please specify --curl-dir=/path/to/built/libcurl
[end of output]
But --curl-dir is not an option supported by pip, only by the underlying python executable. I do have curl installed already, and in the path, but there seems to be no way I can figure out to tell perl where it is, in a way that will let this pip installation just work the way it's supposed to.

I'm not a python genius, and don't know what a "wheel" file is or where it goes. The directory that --curl-dir wants is C:\ProgramData\chocolatey\lib\curl\tools\curl-8.6.0_1-win64-mingw\lib .

Following an ancient tip at https://curl.se/mail/curlpython-2009-08/0005.html , I set up a Windows system env var: CURL_DIR = C:\ProgramData\chocolatey\lib\curl\tools\curl-8.6.0_1-win64-mingw and re-ran the pip installation, and it failed again with the same error. Same when I tried CURL_DIR = C:\ProgramData\chocolatey\lib\curl\tools\curl-8.6.0_1-win64-mingw\bin;C:\ProgramData\chocolatey\lib\curl\tools\curl-8.6.0_1-win64-mingw\lib

Someone on some other site suggested that urllib3 might supply curl, so I did pip install --pre urllib3[all] and it ran fine, and the attempt to install pycurl still fails.

So, kinda at a loss for what to try next.

Ultimately, the goal is to install a tool called pyLoad, for which pycurl is a dependency.

@gvanem
Copy link
Contributor

gvanem commented Feb 8, 2024

I'm not a python genius, and don't know what a "wheel" file is or where it goes.

I gave up on the obscure Windows build method long time ago and created this GNU-makefile for PyCurl.
Edit to suite your location of libcurl etc. and try it if you like.

@swt2c
Copy link
Contributor

swt2c commented Feb 8, 2024

@SMcCandlish the pycurl wheels are already-built versions of pycurl so you do not have to built it yourself, just install.

https://stackoverflow.com/questions/27885397/how-do-i-install-a-python-package-with-a-whl-file

@twangboy
Copy link

twangboy commented Feb 8, 2024

We stopped bundling pycurl in our Windows packages because of this problem. I don't know why they ever stopped offering the wheel files.

@swt2c
Copy link
Contributor

swt2c commented Feb 8, 2024

https://pypi.org/project/pycurl/7.45.2/#files Why is there no wheel files?

Building pycurl wheels is complicated, we're working on getting it back going again.

@swt2c
Copy link
Contributor

swt2c commented Feb 8, 2024

https://pypi.org/project/pycurl/7.45.2/#files Why is there no wheel files?

Building pycurl wheels is complicated, we're working on getting it back going again.

But how can pycurl be installed on windows then?

Build a wheel yourself is the only choice currently.

@swt2c
Copy link
Contributor

swt2c commented Feb 8, 2024

https://pypi.org/project/pycurl/7.45.2/#files Why is there no wheel files?

Building pycurl wheels is complicated, we're working on getting it back going again.

But how can pycurl be installed on windows then?

Build a wheel yourself is the only choice currently.

Do you mean USERS should mess around with compiling????

It's not ideal but that's the current state of things.

@SMcCandlish
Copy link

SMcCandlish commented Feb 9, 2024

swt2c's "artifacts" file provided what I needed. I figured out eventually that "cp312" referred not to a C compliler but to cPython 3.12 AKA a python --version result of "Python 3.12.[something]", so I picked the latest .whl file and (following StackOverflow hints) did:

pip install C:\Users\USERNAME\Downloads\pycurl-7.45.2-cp312-cp312-win_amd64.whl

and got:

Processing c:\users\USERNAME\downloads\pycurl-7.45.2-cp312-cp312-win_amd64.whl
Installing collected packages: pycurl
Successfully installed pycurl-7.45.2

Then after that, doing:
pip install --pre pyload-ng
worked without a hitch

Unfortunately, the app itself does not run right:

pyload --version

KeyError: 3
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "C:\Program Files\Python312\Scripts\pyload.exe\__main__.py", line 4, in <module>
from pyload.__main__ import main
File "C:\Program Files\Python312\Lib\site-packages\pyload\__main__.py", line 12, in <module>
from .core import Core
File "C:\Program Files\Python312\Lib\site-packages\pyload\core\__init__.py", line 26, in <module>
from .utils import format, fs
File "C:\Program Files\Python312\Lib\site-packages\pyload\core\utils\format.py", line 11, in <module>
from .misc import is_plural
File "C:\Program Files\Python312\Lib\site-packages\pyload\core\utils\misc.py", line 6, in <module>
import js2py
File "C:\Program Files\Python312\Lib\site-packages\js2py\__init__.py", line 72, in <module>
from .base import PyJsException
File "C:\Program Files\Python312\Lib\site-packages\js2py\base.py", line 2965, in <module>
@Js
^^
File "C:\Program Files\Python312\Lib\site-packages\js2py\base.py", line 165, in Js
return PyJsFunction(val, FunctionPrototype)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Python312\Lib\site-packages\js2py\base.py", line 1377, in __init__
cand = fix_js_args(func)
^^^^^^^^^^^^^^^^^
File "C:\Program Files\Python312\Lib\site-packages\js2py\utils\injector.py", line 27, in fix_js_args
code = append_arguments(six.get_function_code(func), ('this', 'arguments'))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Python312\Lib\site-packages\js2py\utils\injector.py", line 121, in append_arguments
arg = name_translations[inst.arg]
~~~~~~~~~~~~~~~~~^^^^^^^^^^
KeyError: 3

That's all gibberish to me, and I'll bring it up on pyLoad's github page, but at least I have an installation of pycurl now, if it's needed by something else, so thanks for the help. :-)

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

No branches or pull requests

15 participants