bullmq: [Bug]: ModuleNotFoundError: No module named 'redis'

Version

v0.5.2

Platform

Python

What happened?

Hey team! I love bullmq and found this little guy checking out the python prototype.

This happened installing bullmq inside a docker container: python v3.10.12 bullmq v0.5.2 (latest)

Error: ModuleNotFoundError: No module named ‘redis’

I can confirm that Installing 0.4.3 and then installing 0.5.2 works just fine, so it must be a dependency or requirement issue

I would submit a pull request myself however I am unfamiliar with python and it’s package manager, so I feel someone else might be better suited.

How to reproduce.

Just run pip install bullmq on a system that has no prior bullmq installed before.

Relevant log output

------- original error, straight up install of 0.5.2 --------
root@a8b103d9200a:/usr/src/app# pip install bullmq
Collecting bullmq
  Downloading bullmq-0.5.2.tar.gz (34 kB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [12 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-9li_njj4/bullmq_206a44b6f8334b358eecdbf61726f675/setup.py", line 2, in <module>
          from bullmq import __version__
        File "/tmp/pip-install-9li_njj4/bullmq_206a44b6f8334b358eecdbf61726f675/bullmq/__init__.py", line 10, in <module>
          from bullmq.queue import Queue
        File "/tmp/pip-install-9li_njj4/bullmq_206a44b6f8334b358eecdbf61726f675/bullmq/queue.py", line 1, in <module>
          from bullmq.redis_connection import RedisConnection
        File "/tmp/pip-install-9li_njj4/bullmq_206a44b6f8334b358eecdbf61726f675/bullmq/redis_connection.py", line 1, in <module>
          import redis.asyncio as redis
      ModuleNotFoundError: No module named 'redis'
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details


------ installing 0.4.3 then 0.5.2 ---------
root@a8b103d9200a:/usr/src/app# pip install bullmq==0.4.3
Collecting bullmq==0.4.3
  Downloading bullmq-0.4.3.tar.gz (34 kB)
  Preparing metadata (setup.py) ... done
Collecting redis (from bullmq==0.4.3)
  Downloading redis-4.5.5-py3-none-any.whl (240 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 240.3/240.3 kB 4.1 MB/s eta 0:00:00
Collecting msgpack (from bullmq==0.4.3)
  Downloading msgpack-1.0.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (316 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 316.8/316.8 kB 939.3 kB/s eta 0:00:00
Collecting semver (from bullmq==0.4.3)
  Downloading semver-3.0.0-py3-none-any.whl (17 kB)
Collecting async-timeout>=4.0.2 (from redis->bullmq==0.4.3)
  Downloading async_timeout-4.0.2-py3-none-any.whl (5.8 kB)
Building wheels for collected packages: bullmq
  Building wheel for bullmq (setup.py) ... done
  Created wheel for bullmq: filename=bullmq-0.4.3-py3-none-any.whl size=55945 sha256=ab7b0188c9c19e7e87e931c5a7a30f2832d624c966603c13ed06ba492f33965f
  Stored in directory: /root/.cache/pip/wheels/b5/51/2b/e10d01cc75c551df4dca7a63b5afdd5e05630e69c15e7d7b36
Successfully built bullmq
Installing collected packages: msgpack, semver, async-timeout, redis, bullmq
Successfully installed async-timeout-4.0.2 bullmq-0.4.3 msgpack-1.0.5 redis-4.5.5 semver-3.0.0
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
root@a8b103d9200a:/usr/src/app# pip install bullmq==0.5.2
Collecting bullmq==0.5.2
  Using cached bullmq-0.5.2.tar.gz (34 kB)
  Preparing metadata (setup.py) ... done
Requirement already satisfied: redis in /usr/local/lib/python3.10/dist-packages (from bullmq==0.5.2) (4.5.5)
Requirement already satisfied: msgpack in /usr/local/lib/python3.10/dist-packages (from bullmq==0.5.2) (1.0.5)
Requirement already satisfied: semver in /usr/local/lib/python3.10/dist-packages (from bullmq==0.5.2) (3.0.0)
Requirement already satisfied: async-timeout>=4.0.2 in /usr/local/lib/python3.10/dist-packages (from redis->bullmq==0.5.2) (4.0.2)
Building wheels for collected packages: bullmq
  Building wheel for bullmq (setup.py) ... done
  Created wheel for bullmq: filename=bullmq-0.5.2-py3-none-any.whl size=57620 sha256=7e337be7f32c8414699486bc4c770dc9fb55fd4541aa3cc91b84862e73b3cef9
  Stored in directory: /root/.cache/pip/wheels/94/1e/e4/df756b7ed58eaa4fc25f4ae0f5fcc146b2d04fe7fe1db3c519
Successfully built bullmq
Installing collected packages: bullmq
  Attempting uninstall: bullmq
    Found existing installation: bullmq 0.4.3
    Uninstalling bullmq-0.4.3:
      Successfully uninstalled bullmq-0.4.3
Successfully installed bullmq-0.5.2
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv

Code of Conduct

  • I agree to follow this project’s Code of Conduct

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 2
  • Comments: 16 (4 by maintainers)

Commits related to this issue

Most upvoted comments

It would be nice if somebody more knowledgable than me on how pip handles dependencies could shed some light on why this happens 🤔

interestingly enough, when i run pip install redis before running pip install -r requirements.txt the error seems to go away, and starts complaining about other errors.

so it starts complaining about semver with the same error, then msgpack but ultimately when i set my build command to pip install redis; pip install msgpack; pip install semver; pip install -r requirements.txt it works.

so most likely those requirements are nto actualyl being loaded into bullmqs own modules although pip seems to be recognizing it.

worth saying i only ran into these issues in a deploy environment.

hi @vraj-fyno, sorry for the delay. I’m working on a fix for setting the minimum required version of python

hey guys, could you please try to upgrade your pip: pip3 install --upgrade pip and install last version 1.3.1