Adding libraries to django nonrel - django

I've a project in Django which I'm trying to port to Django-nonrel so that I can upload it to Google app Engine. I've installed django-nonrel and other required libraries by going through the http://djangoappengine.readthedocs.org/en/latest/installation.html
namely: django-nonrel
djangoappengine
djangotoolbox
django-autoload
django-dbindexer
that is by downloading their zip files and placing them in my app directory.
So, my app directory is:
>
<app>/autoload
<app>/dbindexer
<app>/django
<app>/djangoappengine
<app>/djangotoolbox
I also have django in my project directory and have started the project by:
PYTHONPATH=. python django/bin/django-admin.py startproject \
--name=app.yaml --template=djangoappengine/conf/project_template app
If I am adding an external library with pip and adding it to the INSTALLED_APPS of my app's settings.py , it is not recognised by my django-nonrel which is pretty obvious considering the fact that django-nonrel is not installed on my system. It gives me the following error
Traceback (most recent call last):
File "/usr/local/google_appengine/google/appengine/tools/devappserver2/module.py", line 1390, in _warmup
request_type=instance.READY_REQUEST)
File "/usr/local/google_appengine/google/appengine/tools/devappserver2/module.py", line 884, in _handle_request
environ, wrapped_start_response)
File "/usr/local/google_appengine/google/appengine/tools/devappserver2/request_rewriter.py", line 314, in _rewriter_middleware
response_body = iter(application(environ, wrapped_start_response))
File "/usr/local/google_appengine/google/appengine/tools/devappserver2/module.py", line 1297, in _handle_script_request
request_type)
File "/usr/local/google_appengine/google/appengine/tools/devappserver2/module.py", line 1262, in _handle_instance_request
request_type)
File "/usr/local/google_appengine/google/appengine/tools/devappserver2/instance.py", line 371, in handle
raise CannotAcceptRequests('Instance has been quit')
CannotAcceptRequests: Instance has been quit
(nonrel)apurva#apurva-HP-ProBook-6470b:~/project/flogin$ python manage.py runserver
INFO 2015-08-11 16:06:54,606 sdk_update_checker.py:229] Checking for updates to the SDK.
INFO 2015-08-11 16:06:55,511 sdk_update_checker.py:257] The SDK is up to date.
INFO 2015-08-11 16:06:55,633 api_server.py:205] Starting API server at: http://localhost:60055
INFO 2015-08-11 16:06:55,847 dispatcher.py:197] Starting module "default" running at: http://127.0.0.1:8080
INFO 2015-08-11 16:06:55,847 admin_server.py:118] Starting admin server at: http://localhost:8000
INFO 2015-08-11 16:06:58,966 __init__.py:52] Validating models...
ERROR 2015-08-11 16:06:59,045 wsgi.py:263]
Traceback (most recent call last):
File "/usr/local/google_appengine/google/appengine/runtime/wsgi.py", line 240, in Handle
handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
File "/usr/local/google_appengine/google/appengine/runtime/wsgi.py", line 299, in _LoadHandler
handler, path, err = LoadObject(self._handler)
File "/usr/local/google_appengine/google/appengine/runtime/wsgi.py", line 96, in LoadObject
__import__(cumulative_path)
File "/home/apurva/project/flogin/djangoappengine/main/__init__.py", line 66, in <module>
validate_models()
File "/home/apurva/project/flogin/djangoappengine/main/__init__.py", line 55, in validate_models
num_errors = get_validation_errors(s, None)
File "/home/apurva/project/flogin/django/core/management/validation.py", line 34, in get_validation_errors
for (app_name, error) in get_app_errors().items():
File "/home/apurva/project/flogin/django/db/models/loading.py", line 196, in get_app_errors
self._populate()
File "/home/apurva/project/flogin/django/db/models/loading.py", line 75, in _populate
self.load_app(app_name, True)
File "/home/apurva/project/flogin/django/db/models/loading.py", line 97, in load_app
app_module = import_module(app_name)
File "/home/apurva/project/flogin/django/utils/importlib.py", line 42, in import_module
__import__(name)
ImportError: No module named oauth2_provider
However, I'm unsure on how to add external libraries to my project. So that my django-nonrel recognises it. I've also tried google's documentation on how to this i.e.
Adding Third-party Packages to the Application
You can add any third-party library to your application, as long as it
is implemented in "pure Python" (no C extensions) and otherwise
functions in the App Engine runtime environment. The easiest way to
manage this is with a ./lib directory.
Create a directory named lib in your application root directory:
mkdir lib To tell your app how to find libraries in this directory,
create (or modify) a file named appengine_config.py in the root of
your project, then add these lines:
from google.appengine.ext import vendor
£ Add any libraries installed in the "lib" folder. vendor.add('lib') Use pip with the -t lib flag to install libraries in this directory:
$ pip install -t lib gcloud Note: pip version 6.0.0 or higher is
required for vendor to work properly.
Tip: the appengine_config.py above assumes that the current working
directory is where the lib folder is located. In some cases, such as
unit tests, the current working directory can be different. To avoid
errors, you can explicity pass in the full path to the lib folder
using
vendor.add(os.path.join(os.path.dirname(os.path.realpath(file)),
'lib'))
didn't work either.

So I had a very similar dilemma. Here is how I solved it:
Followed Google's instructions noted above, using pip and a ./lib directory. Make sure you have an updated version of pip:
sudo pip install --upgrade pip
Then, because of pkg_resources issues, I did this:
pip install -t lib setuptools
That was necessary, I am just not sure if that was the right place to install setuptools or not. It certainly worked, though.
Then, I launched the local development server like this, in the project directory:
PYTHONPATH=lib ./manage.py runserver
I hope that works for you!

Related

Problem with migrating a django server (syntax error)

I am trying to make a django server for a sociometric badge (https://github.com/HumanDynamics/openbadge-server) for our university's project. The code (and the whole badge) has been done by someone else and I have not myself changed anything, I am simply trying to get it to work. I am able to build the server but when trying to migrate or create a superuser, I get a syntax error. I've been trying to troubleshoot it by myself but I have very limited knowledge of python, django and Ubuntu so I'm probably missing something.
The error implies an error in the line 44 of /usr/local/lib/python2.7/site-packages/pkgconf/init.py but I cannot find the file so I cannot check it. In fact, the whole site-packages folder is empty so I wonder if I have installed modules in a wrong way? The code is written in python2.7 (Which I cannot change as it is not my code) so I also wonder if the python2.7 being EOL could cause issues? It has already broken some parts, mainly how to get some of the dependencies.
The code and docker files used in this project can be found here: https://github.com/HumanDynamics/openbadge-server
The dependency versions should be fine, the Django version should be compatible with Python2.7 and same for other modules. I've tried changing the versions around but to no avail. Down here is the requirement texts
Django==1.8.4
Fabric==1.10.2
django-grappelli==2.7.1
simplejson==3.8.0
MarkupSafe==0.23
django-pipeline==1.5.4
djangorestframework==3.2.3
djangorestframework-expiring-authtoken==0.1.1
pytz==2015.7
python-dateutil==2.5.3
jsonfield==1.0.3
django-controlcenter===0.2.6
# Configuration
django-environ==0.4.1
# Python-PostgreSQL Database Adapter
psycopg2==2.7.3.2
# Unicode slugification
awesome-slugify==1.6.5
# Import and export using the admin tool
# Using tablib 0.12.1. Newer versions break the import-export add-on
tablib==0.12.1
django-import-export==1.0.0
coverage==4.3.1
django-coverage-plugin==1.3.1
Sphinx==1.5.1
django-extensions==1.7.5
Werkzeug==0.11.15
django-test-plus==1.0.16
factory-boy==2.8.1
django-debug-toolbar==1.6
# improved REPL
ipdb==0.10.1
pytest-django==3.1.2
pytest-sugar==0.8.0
This is the error. From my limited knowledge, I'd gather that it doesn't find the files from /usr/local/lib/python2.7/site-packages/ but it is completely empty, the dependencies are either installed locally or to dist-packages. Someone earlier said that it was a python3 problem but nothing should be Python3. Could it also be a docker version problem if the build somehow installs wrong things?
Starting openbadge-server_postgres_1 ... done
Postgres is up - continuing...
Traceback (most recent call last):
File "manage.py", line 23, in <module>
execute_from_command_line(sys.argv)
File "/usr/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 338, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 312, in execute
django.setup()
File "/usr/local/lib/python2.7/site-packages/django/__init__.py", line 18, in setup
apps.populate(settings.INSTALLED_APPS)
File "/usr/local/lib/python2.7/site-packages/django/apps/registry.py", line 85, in populate
app_config = AppConfig.create(entry)
File "/usr/local/lib/python2.7/site-packages/django/apps/config.py", line 86, in create
module = import_module(entry)
File "/usr/local/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/usr/local/lib/python2.7/site-packages/controlcenter/__init__.py", line 1, in <module>
from .dashboards import Dashboard # NOQA
File "/usr/local/lib/python2.7/site-packages/controlcenter/dashboards.py", line 10, in <module>
from . import app_settings
File "/usr/local/lib/python2.7/site-packages/controlcenter/app_settings.py", line 1, in <module>
from pkgconf import Conf
File "/usr/local/lib/python2.7/site-packages/pkgconf/__init__.py", line 44
class Conf(metaclass=ConfMeta):
^
SyntaxError: invalid syntax
I will provide information to best of my abilities.
Fixed the issue by adding django-pkgconf==0.3.0 to the requirements. While the requirements did not have the package at all, it was still installed (and used) through other packages and it installed version 0.4.0 which does not support Python 2.7.
Weird thing is that I could not find a trace where it was installed if I installed it without having it on requirements so even when I manually installed 0.3.0, it would still use 0.4.0 (despite seemingly not having it installed) so in order to get it to work it had to be installed through the docker build.

not installed requirements.txt on django project

I am new to programming and this is my first project
trying to start a django project on the server
activated virtual environment
after the pip install -r requirements.txt command, an error occurs
Exception:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 353, in run
wb.build(autobuilding=True)
File "/usr/lib/python2.7/dist-packages/pip/wheel.py", line 749, in build
self.requirement_set.prepare_files(self.finder)
File "/usr/lib/python2.7/dist-packages/pip/req/req_set.py", line 380, in prepa re_files
ignore_dependencies=self.ignore_dependencies))
File "/usr/lib/python2.7/dist-packages/pip/req/req_set.py", line 554, in _prep are_file
require_hashes
File "/usr/lib/python2.7/dist-packages/pip/req/req_install.py", line 278, in p opulate_link
self.link = finder.find_requirement(self, upgrade)
File "/usr/lib/python2.7/dist-packages/pip/index.py", line 465, in find_requir ement
all_candidates = self.find_all_candidates(req.name)
File "/usr/lib/python2.7/dist-packages/pip/index.py", line 423, in find_all_ca ndidates
for page in self._get_pages(url_locations, project_name):
File "/usr/lib/python2.7/dist-packages/pip/index.py", line 568, in _get_pages
page = self._get_page(location)
File "/usr/lib/python2.7/dist-packages/pip/index.py", line 683, in _get_page
return HTMLPage.get_page(link, session=self.session)
File "/usr/lib/python2.7/dist-packages/pip/index.py", line 795, in get_page
resp.raise_for_status()
File "/usr/share/python-wheels/requests-2.18.4-py2.py3-none-any.whl/requests/m odels.py", line 935, in raise_for_status
raise HTTPError(http_error_msg, response=self)
HTTPError: 404 Client Error: Not Found for url: https://pypi.org/simple/beatiful lsoup4/
Ok By watching at your problem i saw that there is a typo error in beautifulsoup4 library in requirements.txt file , and in comments as mentioned that u are also facing error in installing django
Could not find a version that satisfies the requirement Django==2.0.7 (from -r requirements.txt (line 3)) (from versions: (any versions) .No matching distribution found for Django==2.0.7 –
Django above 2 version support only python3 , so try
pip3 install django==2.0.7
if you have python3.5 and above in your system
Also to see supported versions by pip try:
pip install django==0
and
pip3 install django==0
make sure you are not using vpn.
What OS are you in? Make sure to have installed everything correctly, make the folders following official docs or maybe a tutorial, make sure to always use the right environment, in which Django has been properly installed via pip (I use pip3) Make sure before to have the latest version of Python supported (I use 3.8.2) and the latest version of pip. Make all the passages again and see what happens. If something goes wrong, be more detailed on what you've done.
Going over your problem again, I found that 2.0.7 indeed a correct version.
But in your requirements.txt its written as Django==2.0.7 that should be django==2.0.7

Getting error: DLL load failed: The operating system cannot run %1 - Python 2.7; Scrapy Module; Importing Cryptography

I cannot successfully run the first command in the Scrapy tutorial (http://doc.scrapy.org/en/latest/intro/tutorial.html). The code copy pasted below is the result (with the error at the end).
Python 2.7 is installed, and I followed the installation instructions for scrapy (http://doc.scrapy.org/en/latest/intro/install.html). I am running Python 2.7.6 32 bit on Windows 7 (64 bit).
Other aspects of installation:
Twisted-13.2.0.dist-info
zope.interface-4.1.1-py2.7
Scrapy-0.22.2-py2.7
lxml-3.3.3-py2.7
cssselect-0.9.1-py2.7
cryptography-0.3.dist-info
pyOpenSSL-0.14-py2.7
pywin32_system32
And here's the error message:
C:\Python27\Scripts>scrapy startproject tutorial
Traceback (most recent call last):
File "C:\Python27\lib\runpy.py", line 162, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "C:\Python27\lib\runpy.py", line 72, in _run_code
exec code in run_globals
File "C:\Python27\lib\site-packages\scrapy\cmdline.py", line 9, in <module>
from scrapy.crawler import CrawlerProcess
File "C:\Python27\lib\site-packages\scrapy\crawler.py", line 3, in <module>
from twisted.internet import reactor, defer
File "twisted\internet\reactor.py", line 38, in <module>
from twisted.internet import default
File "twisted\internet\default.py", line 56, in <module>
install = _getInstallFunction(platform)
File "twisted\internet\default.py", line 50, in _getInstallFunction
from twisted.internet.selectreactor import install
File "twisted\internet\selectreactor.py", line 18, in <module>
from twisted.internet import posixbase
File "twisted\internet\posixbase.py", line 24, in <module>
from twisted.internet import error, udp, tcp
File "twisted\internet\tcp.py", line 29, in <module>
from twisted.internet._newtls import (
File "twisted\internet\_newtls.py", line 21, in <module>
from twisted.protocols.tls import TLSMemoryBIOFactory, TLSMemoryBIOProtocol
File "twisted\protocols\tls.py", line 40, in <module>
from OpenSSL.SSL import Error, ZeroReturnError, WantReadError
File "build\bdist.win32\egg\OpenSSL\__init__.py", line 8, in <module>
File "build\bdist.win32\egg\OpenSSL\rand.py", line 11, in <module>
File "build\bdist.win32\egg\OpenSSL\_util.py", line 4, in <module>
File "C:\Python27\lib\site-packages\cryptography\hazmat\bindings\openssl\binding.py", l3, in __init__
self._ensure_ffi_initialized()
File "C:\Python27\lib\site-packages\cryptography\hazmat\bindings\openssl\binding.py", l9, in _ensure_ffi_initialized libraries)
File "C:\Python27\lib\site-packages\cryptography\hazmat\bindings\utils.py", line 77, ind_ffi
ext_package="cryptography",
File "C:\Python27\lib\site-packages\cffi\api.py", line 341, in verify
lib = self.verifier.load_library()
File "C:\Python27\lib\site-packages\cffi\verifier.py", line 75, in load_library
return self._load_library()
File "C:\Python27\lib\site-packages\cffi\verifier.py", line 151, in _load_library
return self._vengine.load_library()
File "C:\Python27\lib\site-packages\cffi\vengine_cpy.py", line 138, in load_library
raise ffiplatform.VerificationError(error)
cffi.ffiplatform.VerificationError: importing 'C:\\Python27\\lib\\site-packages\\cryptogr
\_Cryptography_cffi_48bbf0ebx93c91939.pyd': DLL load failed: The operating system cannot
1.**
I just reinstall cryptography to make it work.
pip uninstall cryptography
pip install cryptography
I had this problem due to another (older?) version of libeay32.dll and ssleay32.dll being on the PATH before those of my own OpenSSL 1.0.1g installation. I recommend you use Process Monitor from SysInternals to monitor python.exe to see where it is actually loading your OpenSSL DLLs from.
In my case, the offender was some Intel components at C:\Program Files (x86)\Intel\iCLS Client\ that came with my drivers. After moving my own OpenSSL bin directory earlier in the PATH environment variable, everything worked as expected.
this is due to _Cryptography_cffi_48bbf0ebx93c91939.pyd depends on openssl dll ssleay32.dll and libeay32.dll. after you compile openssl on windows, u can copy these 2 files to system32.
#crazyzh1984's method is a little complex, but his supplement that posted at the bottom of his answer is very useful. I download the "Win32 OpenSSL v1.0.1g Light" at http://slproweb.com/products/Win32OpenSSL.html and then I could install pyOpenSSL successfully.
#lambokini is right,but i'cant comment on the answer, so come this one.
First download openssl source from http://www.openssl.org/
Second start "Visual Studio Command Prompt", compile and install openssl follow install guide(INSTALL.W32 or INSTALL.W64).
Then add "[openssl install path]\bin" to the environment variable "path",
and you can delete ssleay32.dll and libeay32.dll under system32.
Notice: dll will be load from the first place it seached.
for exmple: Path=xxx;d:\PHP5;d:\openssl\bin;
if ssleay32.dll and libeay32.dll also appears under PHP5,
then python will load that one.
I'll write my own take on this due to my extreme frustration and hopes that this might help some other poor chap with his issues getting scrapy to work on windows..
Had a similar issues with faulty libeay32.dll and ssleay32.dll, or so it would seem, but confirmed it with Process Monitor.
It all went to hell after those dll's were found in System32:
So i wasnt suffering from wrong PATHs (but i did change their order so system32 comes before C:\Program Files (x86)\Intel\iCLS Client\.
Next i used this site the other guys here pointed to. Ive used Win32 OpenSSL v1.0.2j Light, since the newer one (1.1.0b) didnt generate these dlls for me for some reason.
Generate them in a different bin folder so you see they are new, and then copy them to system32. Voila, scrapy command line works.
Also, as of today, anaconda's scrapy 1.1.2 does not create a key file for running scrapy commands, ive opened and closed a question about this issue here.
As others have said above, there are two .dll files that are loaded instead of the openssl that is downloaded with Scrapy. Those two .dll files are not compatible.
I resolved this by placing the downloaded .dll files (i used Anaconda to install scrapy) as a higher priority in the Environment Variables as shown in the attached image.
In Environment Variables, within System Variables and the "Path" i placed the Anaconda3 location as shown above at the top and therefore makes it the priority when python comes to load openssl
As already mentioned in the other answers, the issue is caused by the two files ssleay32.dll and libeay32.dll.
The error occurred when importing OpenSSL in Python
>>> from OpenSSL import crypto, SSL
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "c:\Python27\lib\site-packages\OpenSSL\__init__.py", line 8, in <module>
from OpenSSL import crypto, SSL
ImportError: DLL load failed: The operating system cannot run %1.
Here's how I solved the issue on Windows 10. If you have git for Windows (download here) you can just copy these two files from Git\mingw64\bin\ to some location in your path. What worked for me was to copy them to c:\Windows (or else to the folder from which you're starting Python).
To find the locations of the dll files type at a cmd prompt:
>where libeay32.dll
C:\Program Files (x86)\Intel\TXE Components\TCS\libeay32.dll
...
C:\Users\me\AppData\Local\Programs\Git\mingw64\bin\libeay32.dll
I ran across this error today on a Windows 7 system. The problem for me was similar to #user2314737, #voetsjoeba, and #Olegp. libeay32.dll and ssleay32.dll where in folders related to Intel that were in the Windows path environmental variable.
Unfortunately, my system is locked (work computer), so I could not move the files or alter the system's path variable. Instead, I manually removed the Intel related items from the path variable that Python accesses using:
import os
os.environ['path'] = ';'.join(
filter(lambda x: 'intel' not in x.lower(), os.environ['path'].split(';'))
)
import OpenSSL

virtualenv is not compatible with this system or executable

I am rather new to Linux (Ubuntu) and installing (Python) packages. I'm having trouble with mkvirtualenv and can not solve it:
~$ mkvirtualenv mysite70
New python executable in mysite70/bin/python
Traceback (most recent call last):
File "/usr/lib/python2.7/site.py", line 562, in <module>
main()
File "/usr/lib/python2.7/site.py", line 544, in main
known_paths = addusersitepackages(known_paths)
File "/usr/lib/python2.7/site.py", line 271, in addusersitepackages
user_site = getusersitepackages()
File "/usr/lib/python2.7/site.py", line 246, in getusersitepackages
user_base = getuserbase() # this will also set USER_BASE
File "/usr/lib/python2.7/site.py", line 236, in getuserbase
USER_BASE = get_config_var('userbase')
File "/usr/lib/python2.7/sysconfig.py", line 577, in get_config_var
return get_config_vars().get(name)
File "/usr/lib/python2.7/sysconfig.py", line 476, in get_config_vars
_init_posix(_CONFIG_VARS)
File "/usr/lib/python2.7/sysconfig.py", line 355, in _init_posix
raise IOError(msg)
IOError: invalid Python installation: unable to open /home/sietse/.virtualenvs/mysite70/local/include/python2.7/pyconfig.h (No such file or directory)
ERROR: The executable mysite70/bin/python is not functioning
ERROR: It thinks sys.prefix is u'/home/usr/.virtualenvs' (should be u'/home/usr/.virtualenvs/mysite70')
ERROR: virtualenv is not compatible with this system or executable
Did I install something wrong?
This is likely a permissions error with your current logged in user on the Linux machine.
Try
sudo mkvirtualenv mysite70
This will often prompt for the password of the root user.
If that does not work, you may want to look at the article below:
http://noelusion.com/2013/Fixing-the-mysterious-virtualenv-error-IOError-invalid-Python-installation/
But note, that the article is a hack on a fairly specific instance.
I think I messed up the installation. I reinstalled Ubuntu, virtualenv etc. It works fine now.
Make sure your username has accents or special characters. If yes, change directory creating environments creating an environment variable WORKON_HOME with value equal to the new path. Ex .: C:\Envs

Errors while installing python packages

I 'm not able to install python packages from both pip and easy_install. There's some absurd kind of error that keeps popping up. Kindly help to rectify it.
I get the same errors while using python setup.py install.
Error while installing django-memcached
C:\Users\Praful\Desktop\django-redis-master>easy_install django-memcached
Traceback (most recent call last):
File "C:\Python27\Scripts\easy_install-script.py", line 9, in <module>
load_entry_point('distribute==0.6.27', 'console_scripts', 'easy_install')()
File "C:\Python27\lib\site-packages\distribute-0.6.27-py2.7.egg\setuptools\com
mand\easy_install.py", line 1915, in main
with_ei_usage(lambda:
File "C:\Python27\lib\site-packages\distribute-0.6.27-py2.7.egg\setuptools\com
mand\easy_install.py", line 1896, in with_ei_usage
return f()
File "C:\Python27\lib\site-packages\distribute-0.6.27-py2.7.egg\setuptools\com
mand\easy_install.py", line 1919, in <lambda>
distclass=DistributionWithoutHelpCommands, **kw
File "C:\Python27\lib\distutils\core.py", line 112, in setup
_setup_distribution = dist = klass(attrs)
File "C:\Python27\lib\site-packages\distribute-0.6.27-py2.7.egg\setuptools\dis
t.py", line 222, in __init__
for ep in pkg_resources.iter_entry_points('distutils.setup_keywords'):
File "C:\Python27\lib\site-packages\distribute-0.6.27-py2.7.egg\pkg_resources.
py", line 486, in iter_entry_points
entries = dist.get_entry_map(group)
File "C:\Python27\lib\site-packages\distribute-0.6.27-py2.7.egg\pkg_resources.
py", line 2315, in get_entry_map
self._get_metadata('entry_points.txt'), self
File "C:\Python27\lib\site-packages\distribute-0.6.27-py2.7.egg\pkg_resources.
py", line 2101, in parse_map
raise ValueError("Entry points must be listed in groups")
ValueError: Entry points must be listed in groups
Error while installing python-memcache
C:\Users\Praful\Desktop\mem>python setup.py install
Traceback (most recent call last):
File "setup.py", line 24, in <module>
"Topic :: Software Development :: Libraries :: Python Modules",
File "C:\Python27\lib\distutils\core.py", line 112, in setup
_setup_distribution = dist = klass(attrs)
File "C:\Python27\lib\site-packages\distribute-0.6.27-py2.7.egg\setuptools\dis
t.py", line 222, in __init__
for ep in pkg_resources.iter_entry_points('distutils.setup_keywords'):
File "C:\Python27\lib\site-packages\distribute-0.6.27-py2.7.egg\pkg_resources.
py", line 486, in iter_entry_points
entries = dist.get_entry_map(group)
File "C:\Python27\lib\site-packages\distribute-0.6.27-py2.7.egg\pkg_resources.
py", line 2315, in get_entry_map
self._get_metadata('entry_points.txt'), self
File "C:\Python27\lib\site-packages\distribute-0.6.27-py2.7.egg\pkg_resources.
py", line 2101, in parse_map
raise ValueError("Entry points must be listed in groups")
ValueError: Entry points must be listed in groups
Find get_entry_map(self, group=None): into python\Lib\sitepackages\pkg_resources\__init__.py. Insert after print self.egg_info
Run python setup.py and look to the last printed - broken package.
Remember it, later to install again. Delete the folder of broken
package and folder broken_package-version.dist-info. Run again paragraph 2, until the error disappears.
Remove changes from paragraph 1.
python setup.py install 'broken_package'
This error happened to me installing any package. My solution was going to my file explorer, typing in the path bar %appdata%, going to the Python folder, and deleting everything inside.
I found the same problem to be caused by a misfometted entry_points.txt file in one instelled egg of mine.
It can be quite hard to track down which one is if there are many.
I managed to find that little ba##!"d by creating and run setup.py for a dummy package:
setup.py
from setuptools import setup, find_packages
setup(
name = "IWillFindYou",
version = "0.1",
packages = find_packages()
)
run this in debug mode would point to this line in pkg_resources.py
def parse_map(cls, data, dist=None):
[...]
raise ValueError("Entry points must be listed in groups")
if you go back to the stack trace, you will see that parse_map is called here:
def get_entry_map(self, group=None):
[...]
ep_map = self._ep_map = EntryPoint.parse_map(
self._get_metadata('entry_points.txt'), self
)
evaluating self.egg_info will point up your evil egg so you can give a look to the entry_points.txt file.
If you are not handy with debugger, you may try to place print self.egg_info in get_entry_map and look to the last guy printed.
My Resolution Approach
Platform: windows 10, ConEmu-Maximus5
Delete virtual environment automatically created by poetry install command.
windows users can find the virtual environment folder in the path below
C:\Users\YOUR_PC_USERNAME\AppData\Local\pypoetry\Cache\virtualenvs
(don't know of linux path)
close terminal / command prompt
open terminal / command prompt and navigate to project folder
re run poetry install
I hope it helps...
How i encountered the error
It was my first time using poetry, while running poetry install, the process got interrupted. running the command again popped out the error.
Could be a problem with distribute. I'd recommend re-installing Python.