Having trouble installing pycurl on windows
Asked Answered
R

5

16

I'm having trouble getting pycurl installed on my windows computer. At first I tried pip, but ran into the “Please specify --curl-dir=/path/to/built/libcurl” error, and have since tried installing curl before running it again.

I downloaded curl from http://curl.haxx.se/download.html and have extracted it into it's own folder.

I tried the following:

D:\Downloads\pycurl-7.19.5.1\pycurl-7.19.5.1>python setup.py install --curl-dir="D:\Downloads\curl-7.40.0\curl-7.40.0"

But received the following error.

Using curl directory: D:\Downloads\curl-7.40.0\curl-7.40.0
libcurl.lib does not exist at D:\Downloads\curl-7.40.0\curl-7.40.0\lib\libcurl.lib.
Curl directory must point to compiled libcurl (bin/include/lib subdirectories):

I can't find this libcurl.lib file that it's looking for.

Any help would be appreciated.

UPDATE:

Have re-downloaded a new library from the same website, curl-7.40.0-win64, which contains a libcurl.lib file.

D:\Downloads\pycurl-7.19.5.1\pycurl-7.19.5.1>python setup.py install --curl-dir=
"D:\Downloads\curl-7.40.0-win64\curl-7.40.0-win64\"
Curl directory does not exist: D:\Downloads\curl-7.40.0-win64\curl-7.40.0-win64"


D:\Downloads\pycurl-7.19.5.1\pycurl-7.19.5.1>python setup.py install --curl-dir=
"D:\Downloads\curl-7.40.0-win64\curl-7.40.0-win64\lib"
Using curl directory: D:\Downloads\curl-7.40.0-win64\curl-7.40.0-win64\lib
libcurl.lib does not exist at D:\Downloads\curl-7.40.0-win64\curl-7.40.0-win64\l
ib\lib\libcurl.lib.
Curl directory must point to compiled libcurl (bin/include/lib subdirectories):
D:\Downloads\curl-7.40.0-win64\curl-7.40.0-win64\lib

D:\Downloads\pycurl-7.19.5.1\pycurl-7.19.5.1>
Rhaetic answered 2/2, 2015 at 21:51 Comment(4)
I downloaded curl-7.40.0-win64 and it definitely has libcurl.lib present in its lib directory. Might you need to download it again?Flournoy
@PaulRooney I re-downloaded the file you described, extracted and tried again. See my edit.Rhaetic
Can you download the pycurl wheel file for your python version and try installing it with pipMesothorium
I have given an anwer here to a different question but it fits here too. In short find the windows installer for a higher package and then downgrade. #47889257Reiterant
A
9

Another simple way to resolve the problem is to use Christoph Gohlke's collection of Python Extension Package for Windows.

Steps

  1. Visit the link above and use Ctrl+F and search for pycurl, or use this link to directly go to the pycurl binaries
  2. Download the relevant PycURL version. Remember that the PycURL version in the file name must match the version in your requirements.txt file (if you're using one), and cpXXX needs to match your version of Python (thanks @d6stringer)
  3. Copy the file to your working directory and then pip install that file e.g. pip install .\pycurl-7.43.0.5-cp39-cp39-win_amd64.whl (thanks @jlr)
  4. Re-run pip install -r requirements.txt or whatever command you were running
Aulos answered 6/11, 2017 at 10:29 Comment(3)
This was the easiest for me, everyone on Windows should give this a try. Example: pip install .\pycurl-7.43.0.5-cp39-cp39-win_amd64.whl. And then it's done.Scholasticate
Magical thank you! Worth noting that cpXXX is the version of python you're using.Barnabe
Second time I've found this answer! I took the opportunity to explicitly write out the steps to further help others (and future-me) when this answer pops up againAnking
S
8

It is frustrating how much time I spent looking for a solution to this problem on internet, and finally found all my answers in the official pycurl website

In my arch Linux system I have no problem installing pycurl, but found all this hassle when trying to install pycurl on windows using pip, giving errors:

“Please specify --curl-dir=/path/to/built/libcurl” error

and trying to fix this error with same steps as in "op" question and getting exact errors.

.

Solution for windows:

[EDIT] Unfortunately, option 1 below doesn't work anymore, the link for binaries is down, and reference removed from pycurl documentation.

1- the easy way is to download a ready made official packages, zip, exe, or msi, as mentioned here, official downloads from here. Make sure to choose the link with the same version of your installed python.

For example: pycurl-7.43.0.2.win-amd64-py3.6.exe is an installer for pycurl 7.43.0.2 on windows 64bit, with python 3.6 installed

2- The hard way: Building From Source, as quoted from their website, is not a good idea to do so but still possible,

Building PycURL from source is not for the faint of heart due to the multitude of possible dependencies and each of these dependencies having its own directory structure, configuration style, parameters and quirks. Additionally different dependencies have different settings for MSVCRT usage, and an application must have all of its parts agreeing on a single setting.

If you continue reading here you will find a detailed instructions how to build from source

Finally, I recommend using a ready made package which I think it should be made available to be automatically installed by pip and avoid all this hassle.

Sundog answered 14/11, 2019 at 0:44 Comment(5)
Step 1 - this is the best answer! It's annoying that pyCurl-Homepage says you should be able to install on Windows using PIP when this is clearly not the case.Lodge
The setup exe will work for the main python install, however for a virtual environment, such as pipenv, it will not work. In that case Yuan Ji's answer works well.Spodumene
When I install with the msi installer, I can't import pycurlWentzel
bintray dows not exist anymoreReiterant
@BlueClouds, sadly this is right, will update the answerSundog
I
0

You can find the pycurl package on the website, the execute the command:

pip install xx\xx\pycurl-xx.whl

to install pycurl

Impertinence answered 16/6, 2023 at 0:27 Comment(0)
S
0

Try this command

pip install pycurl==7.43.0.5
Shreeves answered 5/12, 2023 at 7:4 Comment(0)
M
-1

Try to download sources and build it by yourself: as result you will have to get directories like:

  • libcurl-vc12-x86-release-dll-ipv6-sspi-winssl
    • bin
      • curl.exe
      • libcurl.dll
    • include
      • *.h
    • lib
      • libcurl.lib

(or you can search for prebuilt binaries/headers with same directory structure) And then you have to point your setup.py script this directory, such as:

python setup.py install --curl-dir="D:\..\libcurl-vc12-x86-release-dll-ipv6-sspi-winssl

And it will be built successfully.

Marcellusmarcelo answered 27/2, 2015 at 10:53 Comment(1)
I tried to build it. Just gave up and remade the project using Requests.Rhaetic

© 2022 - 2024 — McMap. All rights reserved.