Forums

Error code: 502-backend

have recently tried to install a bootstrap emoji package on my Django website and now I am receiving this error message: Error code: 502-backend.

I am also getting this error in Bash Console:

Traceback (most recent call last):
  File "/home/dict/.virtualenvs/django2/lib/python3.6/site.py", line 703, in <module>
    main()
  File "/home/dict/.virtualenvs/django2/lib/python3.6/site.py", line 683, in main
    paths_in_sys = addsitepackages(paths_in_sys)
  File "/home/dict/.virtualenvs/django2/lib/python3.6/site.py", line 282, in addsitepackages
    addsitedir(sitedir, known_paths)
  File "/home/dict/.virtualenvs/django2/lib/python3.6/site.py", line 204, in addsitedir
    addpackage(sitedir, name, known_paths)
  File "/home/dict/.virtualenvs/django2/lib/python3.6/site.py", line 173, in addpackage
    exec(line)
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'emojiencoding'

I could not find a way to solve this problem. I would appreciate your help.

[edit by admin: formatting]

That's pretty weird -- it looks like your virtualenv has somehow become quite broken.

I'd suggest debugging by editing the file /home/dict/.virtualenvs/django2/lib/python3.6/site.py and adding at line 204, just above the line that says

addpackage(sitedir, name, known_paths)

...some code to print out the values of sitedir, name, and known_paths. Then if you activate your virtualenv and start Python, it will print out all of the packages it's trying to add, and the last one it prints out before the "ModuleNotFoundError" will tell you which file is causing the problem. It may be that once you know that, the solution will be obvious, but if not, just post back here with the details that you find out.

I did that and it showed following: /home/dict/.virtualenvs/django2/lib/python3.6/site-packages backports.csv-1.0.7-py3.7-nspkg.pth {'/home/dict/.virtualenvs/django2/lib/python3 .6', '/home/dict/.virtualenvs/django2/lib/python3.6/lib-dynload', '/home/dict/.virtualenvs/django2/lib/python36.zip', '/usr/lib/python3.6'} /home/dict/.virtualenvs/django2/lib/python3.6/site-packages emoji.pth {'/home/dict/.virtualenvs/django2/lib/python3.6', '/home/dict/.virtuale nvs/django2/lib/python3.6/lib-dynload', '/home/dict/.virtualenvs/django2/lib/python36.zip', '/usr/lib/python3.6'}

Then I deleted two files that had emoji in them from site-packages folder. Now pip works, but the site still shows the same error.

Here is an output when I run pip list: Package Version


backcall 0.1.0
backports.csv 1.0.7
decorator 4.4.0
defusedxml 0.5.0
diff-match-patch 20181111 Django 2.2
django-crispy-forms 1.7.2
django-import-export 1.2.0
django-tinymce 2.8.0
django-tinymce4-lite 1.7.5
et-xmlfile 1.0.1
ipython 7.4.0
ipython-genutils 0.2.0
jdcal 1.4
jedi 0.13.3
jsmin 2.2.2
odfpy 1.4.0
openpyxl 2.6.2
parso 0.4.0
pexpect 4.7.0
pickleshare 0.7.5
pip 19.0.3
prompt-toolkit 2.0.9
ptyprocess 0.6.0
Pygments 2.3.1
pytz 2018.9
PyYAML 5.1
setuptools 41.0.0
six 1.12.0
sqlparse 0.3.0
tablib 0.13.0
traitlets 4.3.2
wcwidth 0.1.7
wheel 0.33.1
xlrd 1.2.0
xlwt 1.3.0

I guess it needed some time. The website is up and working now. Thanks for your help.

Hmm, that's weird -- I guess something you did in the meantime must have had a non-obvious side-effect that somehow cleared things up in the virtualenv. Glad to hear it's working now, anyway!