Skip to content

Resolving orjson dependency conflict when installing django-unicorn in Windows

For those you run

pipenv install django-unicorn

And you get a dependency resolution conflict relating to orjson like this:

django-unicorn 0.2.2 depends on orjson<4.0.0 and >=3.2.1
    django-unicorn 0.2.1 depends on orjson<4.0.0 and >=3.2.1
    django-unicorn 0.2.0 depends on orjson<4.0.0 and >=3.2.1
    django-unicorn 0.1.1 depends on orjson<4.0.0 and >=3.2.1
    django-unicorn 0.1.0 depends on orjson<4.0.0 and >=3.2.1

To fix this you could try to:
1. loosen the range of package versions you've specified
2. remove package versions to allow pip attempt to solve the dependency con
flict

-- then you get plenty of this sort of error below:

WARNING: Discarding https://files.pythonhosted.org/packages/96/74/dff8d2f2c
3c6543b7baffc72762c60358e16ddd54c509243ac4cad33d36d/orjson-3.2.1.tar.gz#sha
256=8e85b607b32adbccfd72ac6b8a1205c523d10eb7b37b46ec142e7f55344710b0 (from
https://pypi.org/simple/orjson/) (requires-python:>=3.6). Command errored o
ut with exit status 1: 'c:\users\andy\.virtualenvs\stud_book-kbrsqal2\scrip
ages\pip\_vendor\pep517\in_process\_in_process.py' prepare_metadata_for_bui
ld_wheel 'C:\Users\Andy\AppData\Local\Temp\tmp9w3u58fn' Check the logs for
full command output.
ERROR: Cannot install -r c:\users\andy\appdata\local\temp\pipenv-q7m541g4-r
versions have conflicting dependencies.
ser_guide/#fixing-conflicting-dependencies

Then you are probably running a 32 bit version of python.

orjson needs a 64 bit version.

To fix this I am assuming you are:

  1. Running on Windows
  2. using pipenv

To find out what version of python your are running type:
python

You will get something like this:

>python
Python 3.7.1 (v3.7.1:260ec2c36a, Oct 20 2018, 14:05:16) [MSC v.1915 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>

Notice how it says 32 bit in the first line?

If it does – we need to install 64 bit python.

To do that go to the Python Windows package list

And pick a 64 bit version.

At the time of this article I installed the Python 3.9.7 64 bit version.

Once installed you will need to update the Pipfile (if you are using pipenv) to be [requires] python_version = "3.9"

Then you’ll need to clean up your pipenv shell:

pipenv --rm

Then rebuild it:

pipenv install

pipenv shell

Then you should be able to:

pipenv install django-unicorn

And success!

pipenv install django-unicorn
Installing django-unicorn...
Adding django-unicorn to Pipfile's [packages]...
Installation Succeeded
Pipfile.lock (1dc94b) out of date, updating to (72e6d2)...
Locking [dev-packages] dependencies...
Locking [packages] dependencies...
           Building requirements...
Resolving dependencies...
Success!
Updated Pipfile.lock (72e6d2)!
Installing dependencies from Pipfile.lock (72e6d2)...
  ================================ 0/0 - 00:00:00

Leave a Reply