juancarlospaco / faster-than-requests

Faster requests on Python 3
https://gist.github.com/juancarlospaco/37da34ed13a609663f55f4466c4dbc3e
MIT License
1.1k stars 91 forks source link

error installing via pip #123

Closed amtsgv closed 3 years ago

amtsgv commented 3 years ago

Hello, trying to install this via command pip install faster-than-requests but i receive an error, are you aware of any workarounds to this?

image

JoeBarouneD commented 3 years ago

Same error on Windows 10

juancarlospaco commented 3 years ago

You have to add these options to the PIP command: --disable-pip-version-check --no-binary :all: --use-deprecated=legacy-resolver

Example: python3.8 -m pip install faster-than-requests==c66bdc9 --no-binary :all: --use-deprecated=legacy-resolver

Why?, I dunno, not my bug, PIP sometimes is weird but they dont care, sorry. :shrug:

Maybe just Git clone the repo, Git works. :)

JoeBarouneD commented 3 years ago

With your CommandLine, i get :

pip install faster-than-requests==c66bdc9 --no-binary :all: --use-deprecated=legacy-resolver
Collecting faster-than-requests==c66bdc9
  Downloading faster_than_requests-c66bdc9.zip (2.0 MB)
     |████████████████████████████████| 2.0 MB 2.2 MB/s
  WARNING: Requested faster-than-requests==c66bdc9 from https://files.pythonhosted.org/packages/15/7e/b9aee0da461905d5d74e8e34ed5705aa3551abdb32688a8ae25c5ffd1072/faster_than_requests-c66bdc9.zip#sha256=bcd79f1903fdaf1c965ab238d281a199fc8a2b4cb1e685e2a395b8dbb9d26616, but installing version 20.11.4
Skipping wheel build for faster-than-requests, due to binaries being disabled for it.
Installing collected packages: faster-than-requests
    Running setup.py install for faster-than-requests ... error
    ERROR: Command errored out with exit status 1:
     command: 'c:\program files\python39\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\JoeBar\\AppData\\Local\\Temp\\pip-install-xyjfrz5q\\faster-than-requests\\setup.py'"'"'; __file__='"'"'C:\\Users\\JoeBar\\AppData\\Local\\Temp\\pip-install-xyjfrz5q\\faster-than-requests\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\JoeBar\AppData\Local\Temp\pip-record-7cwqs5fn\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\program files\python39\Include\faster-than-requests'
         cwd: C:\Users\JoeBar\AppData\Local\Temp\pip-install-xyjfrz5q\faster-than-requests\
    Complete output (6 lines):
    running install
    running build
    running build_ext
    building 'faster_than_requests' extension
    error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
    None
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\program files\python39\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\JoeBar\\AppData\\Local\\Temp\\pip-install-xyjfrz5q\\faster-than-requests\\setup.py'"'"'; __file__='"'"'C:\\Users\\JoeBar\\AppData\\Local\\Temp\\pip-install-xyjfrz5q\\faster-than-requests\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\JoeBar\AppData\Local\Temp\pip-record-7cwqs5fn\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\program files\python39\Include\faster-than-requests' Check the logs for full command output.

As some other libraries, it says i don't have VS14, i don't want to download a 1.5GB program to just have it compiled.

juancarlospaco commented 3 years ago

Good, is working. :+1:

Yes, you need a compiler to compile, thats just how computers work. :shrug:

About the file size, again is not my Bug, report the issue to Microsoft.

That message is emitted by Python itself, so is Python asking you for a compiler, not our library we dont emit that message, again is not my Bug, report the issue to Python.

Other operating systems has compiler builtin, like Linux and Mac.

Same with non-compiled things, you need an interpreter to interpret stuff thats not compiled, so it is the same in the end.

:)

JoeBarouneD commented 3 years ago

I tested to install Git + Nim with your links, it copies too many trash in C:\users and in PATH and is too boring to manage.

I will stick to https://github.com/ross/requests-futures, at least "pip install requests-futures" is working here

juancarlospaco commented 3 years ago

Other operating systems has Git builtin, like Linux, if it copies files were it should not, report the issue to Git.

But if you are developing software you will need to have Git anyways.

Good news is, you wont need them after compilation, so you can delete them all anyways.

So Python could install compiler, compile, uninstall compiler all automatically.

JoeBarouneD commented 3 years ago

Git is not a problem, it exists in portable version. Nim is spread out on C:\users and in PATH, that's why i don't want to use it, so i will not able to compile your project. And i don't want to install VS bloatware just to be able to compile one project.

juancarlospaco commented 3 years ago

VSC is not mandatory, you can use GCC, we recommend GCC for Windows, is tiny and faster.

Theres a portable version of Nim that comes on a ZIP, just unzip and run the EXEs.

JoeBarouneD commented 3 years ago

Thank you, i managed to compile into a .pyd file.

Sorry for my noob question, but is the correct way putting it in "Python\DLLs" or "site-package" directory ?

juancarlospaco commented 3 years ago

Installation is not mandatory from our side, I just always use it from the same folder as the .py

You can have it on current folder or copy it to site-packages folder on the Python directory.

As long as the .pyd is on PATH it should work.

danieldjewell commented 3 years ago

I think this particular issue is really a part of a larger issue:

As it stands, I don't see any CI/Automated Builds... Not only is it a good thing for quality, setting that up helps clear up hidden/assumed dependencies because you have to script/configure the build environment...

Relatedly, as far as I can tell, there isn't a clear way to take the source repo (on a "clean" machine) and make a distribution that matches what's published to Pypi. That's problematic. (Likewise, the complete lack of binary wheels on pypi is an issue -- especially for Windows. Because as noted here, most Windows users don't have the build tools installed...)

Looping back, the issues people are having here are the result of the package not really following what setuptools/PIP expects... (see: PEP20 among others)

This is the first Python package i've run into that is written in Nim. Perhaps consider something like https://github.com/Pebaz/Nimporter ?

juancarlospaco commented 3 years ago

The stuff on /tools/ is not used, I just removed them.

You can use https://pypi.org/project/choosenim-install

CI builds every commit from zero with very basic tools.

The python setup.py sdist works ok.

You need a compiler to compile, thats just how computers work. Good thing is you can remove the compiler after compilation.

The module has zero dependencies once compiled. Installation of the module is not mandatory from our side, it can run without installation. Installation of Nim is not mandatory from our side, it can run without installation.

The only thing required is Nim, you can download the files manually and compile it, Git, Python, PIP/PYPI, etc are not really required from our side.

Pull request welcome if you know how to improve anything.

juancarlospaco commented 3 years ago

Please try installing the latest version:

Older versions may fail due to undocumented changes on PIP/PyPI/etc. That should work correctly. Sorry for the delay. :slightly_smiling_face: