1

I need the python-magic package for a Django project. However, I found out that since I am using python3, I need the python3-magic package, which I can either get using pip3 or using apt-get. I am a macOS user, so I don't have an apt-get, and I cannot install the package using pip3. It gives me the following error when I type: pip3 install python3-magic.

ERROR: Could not find a version that satisfies the requirement python3-magic (from versions: none)
ERROR: No matching distribution found for python3-magic

Is there any way I can get this package for my Django project? No matter what I do, the package appears uninstalled on my VS Code.

Sunderam Dubey
  • 1
  • 11
  • 20
  • 40
Panda
  • 19
  • 5

1 Answers1

1

If you install this through pip3, the name of the package is python-magic [PyPi], not python3-magic, so:

pip3 install python-magic

If you use apt-get, you can work with python3-magic and python-magic. These are not links to a Python package, but in essence intallations scripts that will work with pip3 and pip respectively. See for example the files of the python3-magic package [ubuntu-packages].

Willem Van Onsem
  • 443,496
  • 30
  • 428
  • 555
  • I have tried python-magic with pip3 too. The problem is that the package doesn't appear installed when I try and use it in my project – Panda Jun 20 '22 at 16:34
  • @Panda: are you sure your project is not using a virtual environment, or another interpreter than the one where you install this package for? – Willem Van Onsem Jun 20 '22 at 16:42
  • I think so. There is a folder called A, where I have activated the environment, and inside it is my django folder – Panda Jun 20 '22 at 17:10
  • @Panda: you should activate the environment in the shell where you call `pip3`. – Willem Van Onsem Jun 20 '22 at 18:44