Errors while running pip install -r requirements.txt

I am getting these kinds of error while running pip install -r requirements.txt in virtualenv.

Preparing wheel metadata … error
ERROR: Command errored out with exit status 1:
command: ‘c:\users\manan\appdata\local\programs\python\python38-32\python.exe’ ‘c:\users\manan\appdata\local\programs\python\python38-32\lib\site-packages\pip_vendor\pep517\in_process_in_process.py’ prepare_metadata_for_build_wheel ‘C:\Users\manan\AppData\Local\Temp\tmpn6hvl0o1’
cwd: C:\Users\manan\AppData\Local\Temp\pip-install-1iexwcxx\pywinpty_2dac0a73199142389d89e2fc782409c0
Complete output (6 lines):

Cargo, the Rust package manager, is not installed or is not on PATH.
This package requires Rust and Cargo to compile extensions. Install it through
the system's package manager or via https://rustup.rs/

Checking for Rust toolchain....
----------------------------------------

Hi @Manan_Sharma

I’ve not come across this issue before. Are you installing the files in the virtualenv firstly (running pip within your virtualenv)?

The next step would be to try commenting out ipython in the requirements.txt file and see if you can complete the installation without that library.

Kindest regards,
Eoin

Hi,

I have same problem when I run the command in virtualenv in Window Command Prompt.
(mflix_venv) C:\Program Files\MongoDB\M220P\mflix-python>pip install -r requirements.txt

I try to remove the following lines in requirements.txt, but it still has same error.
ipython==7.8.0
ipython-genutils==0.2.0

Building wheels for collected packages: pyzmq
  Building wheel for pyzmq (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: 'c:\program files\mongodb\m220p\mflix-python\mflix_venv\scripts\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\johnnywen\\AppData\\Local\\Temp\\pip-install-dxytm8iq\\pyzmq_c5a6b4660a3b4976b71ae5577ad5433f\\setup.py'"'"'; __file__='"'"'C:\\Users\\johnnywen\\AppData\\Local\\Temp\\pip-install-dxytm8iq\\pyzmq_c5a6b4660a3b4976b71ae5577ad5433f\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\johnnywen\AppData\Local\Temp\pip-wheel-ygdb66l1'

Thanks,

Johnny

This will be caused by one of the dependencies (with some Rust code in it) not being provided as a binary wheel (for Windows, at least), so it’s attempting to build it from source. I’d like to reproduce this on my own Windows machine. @Johnny_Wen please could you paste the contents of your requirements.txt file here, and I’ll attempt to install it and devise a workaround.

Also, please could you run python --version and pip --version and paste the output here.

Hi Mark,

Thank you for following up this question. I try to attache the requirements.txt file for you, but it doesn’t allow and my account was blocked.

The following is the content of requirements.txt

appnope==0.1.0
attrs==19.1.0
backcall==0.1.0
bcrypt==3.1.7
bleach==3.1.0
cffi==1.13.1
Click==7.0
decorator==4.4.0
defusedxml==0.6.0
dnspython==1.15.0
entrypoints==0.3
Faker==0.8.13
flake8==3.7.8
Flask==0.12.4
Flask-Bcrypt==0.7.1
Flask-Cors==3.0.3
Flask-JWT-Extended==3.7.0
Flask-Login==0.4.0
importlib-metadata==0.23
ipykernel==5.1.3
ipython==7.8.0
ipython-genutils==0.2.0
ipywidgets==7.5.1
itsdangerous==1.1.0
jedi==0.15.1
Jinja2==2.10.3
jsonschema==3.1.1
jupyter==1.0.0
jupyter-client==5.3.1
jupyter-console==6.0.0
jupyter-core==4.4.0
MarkupSafe==1.1.1
mccabe==0.6.1
mistune==0.8.4
more-itertools==7.2.0
nbconvert==5.6.0
nbformat==4.4.0
notebook==6.0.1
pandocfilters==1.4.2
parso==0.5.1
pexpect==4.7.0
pickleshare==0.7.5
pluggy==0.6.0
prometheus-client==0.7.1
prompt-toolkit==2.0.10
ptyprocess==0.6.0
py==1.8.0
pycodestyle==2.5.0
pycparser==2.19
pyflakes==2.1.1
Pygments==2.4.2
PyJWT==1.7.1
pymongo==3.7.2
pyrsistent==0.15.4
pytest==3.3.0
pytest-flask==0.11.0
python-dateutil==2.8.0
pyzmq==18.1.0
qtconsole==4.5.5
Send2Trash==1.5.0
six==1.12.0
terminado==0.8.2
testpath==0.4.2
text-unidecode==1.2
tornado==6.0.3
traitlets==4.3.3
wcwidth==0.1.7
webencodings==0.5.1
Werkzeug==0.16.0
widgetsnbextension==3.5.1
zipp==0.6.0

My computer is Win10 and I have already installed the python3, so I created the virtual environment for MFlix

The following is check the version of Python and Pip
(mflix_venv) C:\Program Files\MongoDB\M220P\mflix-python>python --version
Python 3.8.3

(mflix_venv) C:\Program Files\MongoDB\M220P\mflix-python>pip --version
pip 21.1.3 from c:\program files\mongodb\m220p\mflix-python\mflix_venv\lib\site-packages\pip (python 3.8)

I try to solve the problem, so I did the following steps, but I didn’t pass the test.

  1. Install rustup from https://rustup.rs/
  2. install pipwin and then install pyzmp and pywinpty

pip install pipwin
pipwin install pyzmq
pipwin install pywinpty

Then, I removed “pyzmq==18.1.0” in the requirements.txt and run

pip install -r requirements.txt
After that, I didn’t see any problem.

I can start MFlix, after setup the .ini file and also can see the movie webpage.
(mflix_venv) C:\Program Files\MongoDB\M220P\mflix-python>python run.py

However, when I run the test, there are 39 deselected and cannot get the validation code for Connection

(mflix_venv) C:\Program Files\MongoDB\M220P\mflix-python>pytest -m connection
============================= test session starts =============================
platform win32 -- Python 3.8.3, pytest-3.3.0, py-1.8.0, pluggy-0.6.0
rootdir: C:\Program Files\MongoDB\M220P\mflix-python, inifile: pytest.ini
plugins: flask-0.11.0
collected 43 items

tests\test_db_connection.py ....                                         [100%]

============================= 39 tests deselected =============================
=================== 4 passed, 39 deselected in 5.54 seconds ===================

Please feel free to let me know, if you need any other information.

Thank you for your help,

Johnny

Hi @Johnny_Wen,

Inline text snippets are generally preferable so relevant sections can be quoted in discussion and other users do not have to download files for review.

There are some options for Formatting code and log snippets in posts which can be useful. For example, I added code fencing (```) to your inline requirements.txt which converts it to a scrollable area with syntax highlighting.

Regards,
Stennie

1 Like

Hi @Johnny_Wen, congratulations on fixing your dependency issue! I’ll admit I hadn’t heard of pipwin before.

It looks like pyzmq==18.1.0 is a bad wheel file, so I couldn’t even get as far as you did. I’ve fed back the problem with the version to our education team, and we’ll hopefully get this to run more smoothly for our Windows users in the future.

Now that you have solved the dependency issue, your issue with running the tests is a new problem, so I’d recommend creating a new forum post with a title that describes what’s happening so that someone who knows about the course contents can help you out!

2 Likes