0

I had to install new package on my project to handle with Base64 images from my API, so i installed django-extra-fields, so far so good, i have made my testes locally, everything working just fine, when i pushed my changes to production and installed the new package running pip install django-extra-fields with right virtualenv on, i just keep getting the error ImportError at / No module named drf_extra_fields.fields

That seens a silly mistake, so i checked my code like 100 times so far, and everything is right

I'm using Django 1.11 with Python 2.7

My vm is called: vm-prod_cfr_nuvem When i run pip freeze show all my packages:

(vm-prod_cfr_nuvem) [~ site-packages]$ pip freeze

Django==1.11.6
django-cors-headers==2.1.0
django-extra-fields==2.0.2
django-filter==1.1.0

And if i enter in vm site-packages path, i can see that is installed there

/home/daniloitj/.virtualenvs/vm-prod_cfr_nuvem/lib/python2.7/site-packages

django_cors_headers-2.1.0.dist-info
django_extra_fields-2.0.2.dist-info
django_filter-1.1.0.dist-info

on my view where the show the error, as you can see, is the same path as the last one in list

ImportError at /
No module named drf_extra_fields.fields
...
Python Path:    
['/home/daniloitj/webapps/cfr_prod/lib/python2.7/Django-1.11.9-py2.7.egg',
 '/home/daniloitj/webapps/cfr_prod',
 '/home/daniloitj/webapps/cfr_prod/cfr_nuvem',
 '/home/daniloitj/webapps/cfr_prod/lib/python2.7',
 '/home/daniloitj/lib/python2.7',
 '/home/daniloitj/lib/python2.7',
 '/home/daniloitj/.virtualenvs/vm-prod_cfr_nuvem/lib64/python27.zip',
 '/home/daniloitj/.virtualenvs/vm-prod_cfr_nuvem/lib64/python2.7',
 '/home/daniloitj/.virtualenvs/vm-prod_cfr_nuvem/lib64/python2.7/plat-linux2',
 '/home/daniloitj/.virtualenvs/vm-prod_cfr_nuvem/lib64/python2.7/lib-tk',
 '/home/daniloitj/.virtualenvs/vm-prod_cfr_nuvem/lib64/python2.7/lib-old',
 '/home/daniloitj/.virtualenvs/vm-prod_cfr_nuvem/lib64/python2.7/lib-dynload',
 '/usr/lib64/python2.7',
 '/usr/lib/python2.7',
 '/usr/lib64/python2.7/lib-tk',
 '/home/daniloitj/.virtualenvs/vm-prod_cfr_nuvem/lib/python2.7/site-packages']

Obs.: I thought that somehow my server is not using my VM or something like it... so i activate it manually on my terminal and run python manage.py shell and tried to import the lib import drf_extra_fields im still getting the same error

Obs2.: Didnt found anyone with same problem using that lib, and there is no issues about it, so probabily is my misconfiguration rather than something broke in the lib

Package Page: https://github.com/Hipo/drf-extra-fields

Diego Vinícius
  • 2,125
  • 1
  • 12
  • 23
  • not sure, but can you create a new virtual environment with a name which does not have a `-` in it. Then install dependencies and try again. – ruddra Jan 20 '20 at 10:20
  • i already tried it, and reinstalled the entire requirement, yet no answer so far, and in my template in Python Path is showing that is seaching in new vm – Diego Vinícius Jan 21 '20 at 19:21

1 Answers1

0

That error make me crazy... i solved it going back 1 small version... so instead of using 2.0.2 i'm using 2.0.1, the odd thing is... the 2.0.2 still working on my local environment, but dont work on production, and dont seems be environment problem cuz my server match all requirements to use that lib

Diego Vinícius
  • 2,125
  • 1
  • 12
  • 23