matthewwithanm / django-imagekit

Automated image processing for Django. Currently v4.0
http://django-imagekit.rtfd.org/
BSD 3-Clause "New" or "Revised" License
2.26k stars 276 forks source link

Problems Deploying? #468

Closed kyubae closed 6 years ago

kyubae commented 6 years ago

I'm sorry if this is the wrong place to ask. I'm having issues deploying a project that uses django-imagekit. Everything works locally, however when I try to deploy and run my project via gunicorn I keep getting ImportError: No module named 'imagekit' however pip claims that django-imagekit is already installed and imagekit is listed in the installed apps. I've run pip uninstall imagekit as that was one suggested solution to this and the result has not changed. What could be causing this issue?

vstoykov commented 6 years ago
  1. Can you list your requirements.txt/Pipfile?
  2. How you are deploying?
  3. How you are running it via gunicorn?

I need more context about your environment.

kyubae commented 6 years ago

1.

Django==2.0.2
django-appconf==1.0.2
django-imagekit==4.0.2
django-multiselectfield==0.1.8
myapp==0.1.dev0
pilkit==2.0
Pillow==5.0.0
psycopg2-binary==2.7.4
pytz==2018.3
six==1.11.0
  1. Its just a debian VPS, the local system I'm developing on is also a debian system.
  2. I'm just running gunicorn myapp.wsgi
vstoykov commented 6 years ago

Are you using some kind of virtual environment where you install Python dependencies or you are installing them globbaly?

From the listing in point 1. I can conclude that you are using setup.py instead of requirements.txt or Pipfile because of myapp==0.1.dev0. This means that this is the output of pip freeze in which I can't see gunicorn, which means that this is virtual environment but your gunicorn is installed globbaly and not in the environment. If it is installed globally it can be even installed for different python version that that you are trying to use. The point is that it is not in the environment and when you are executing gunicorn command it starts outside your virtual environment (or with different Python version that that you want) and for that reason it can't find imagekit.

My conclusion can be totally wrong if you are showing me only part of the output or our myapp is real dependency which you are installing from internal package index. If it is the former then i need more context about your environment. If it is the latest I think that you will have enough knowledge to resolve your problem.

kyubae commented 6 years ago

Thanks Gunicorn being installed globally and not in the virtualenv was the issue. I apperciate the help.