Cannot create virtualenv in python 2.7 - python-2.7

I'm trying to create a virtualenv with the following command:
$ virtualenv env --distribute
and I am getting the following message:
...Installing pip...done.
Traceback (most recent call last):
File "/usr/local/bin/virtualenv", line 8, in <module>
load_entry_point('virtualenv==1.8.2', 'console_scripts', 'virtualenv')()
File "/Library/Python/2.7/site-packages/virtualenv.py", line 942, in main
never_download=options.never_download)
File "/Library/Python/2.7/site-packages/virtualenv.py", line 1054, in create_environment
install_pip(py_executable, search_dirs=search_dirs, never_download=never_download)
File "/Library/Python/2.7/site-packages/virtualenv.py", line 655, in install_pip
filter_stdout=_filter_setup)
File "/Library/Python/2.7/site-packages/virtualenv.py", line 1020, in call_subprocess
% (cmd_desc, proc.returncode))
OSError: Command /Users/nigelra/Thero...blog/venv/bin/python -x /Users/nigelra/Thero...env/bin/easy_install /Library/Python/2.7/...ort/pip-1.2.1.tar.gz failed with error code 2
I'm not particularly adept at reading OSX error messages. Would someone be willing to lend their knowledge to solve this problem?

For anyone else who gets error code 2 in the future here is how I dealt with it.
I never figured out which problem made the fix (there were a lot of problems) but I can outline the steps I took to cleaning up my computer.
I followed this guide to setting up my Python environment "right" http://docs.python-guide.org/en/latest/starting/install/osx/
I encounter a ton of errors when I did $ brew doctor
I laboriously got rid of every warning and error using google as my guide.
Many of the folder permissions had to be changed.
Eventually I was able to set up a virtualenv after a re installation of most everything.
Hope this helps anyone who encounters the same mess I did.

Related

Problem when downloading Google CRMint: AttributeError: module 'appcli' has no attribute 'entry_point'

I am trying to install CRMint following these instructions: https://google.github.io/crmint/docs/quickstart/cloudshell.md
When I tried to run to check if I have installed it
crmint --help
The following error appeared
Traceback (most recent call last):
File "/home/user/crmint/.venv/bin/crmint", line 33, in <module>
sys.exit(load_entry_point('crmint', 'console_scripts', 'crmint')())
File "/home/user/crmint/.venv/bin/crmint", line 25, in importlib_load_entry_point
return next(matches).load()
File "/usr/lib/python3.9/importlib/metadata.py", line 79, in load
return functools.reduce(getattr, attrs, module)
AttributeError: module 'appcli' has no attribute 'entry_point'
Could someone help me on that? Thank you in advance.
I tried uninstalling and installing 'appcli', but it still didn't work.
This was around the same time that CRMint was upgraded to it's newest architecture, CRMint 3.0. This was a temporary bug that was impacting deployment, however, the current architecture deployment has been tested and should be working quiet reliably.
Sorry for the inconvenience. Let me know if you have other questions!

I tried to create my first django project(using powershell) but failed to do so because of errors

I am new to django. I wanted to create my first sample project so I followed all the usual ways(as in youtube) and installed python 3.4,pip,django etc. When the environment was set I typed the below command in windows powershell
django-admin startproject mysiteone
and got the below syntax error message(See last para)
My system uses Windows 7 OS. I was unable to find even the version of django i had installed. I dont know why.
I gave these codes in powershell:
django-admin startproject mysiteone
python -m django --version
Error message that I got as a result:
Traceback (most recent call last):
File "C:\Python34\lib\runpy.py", line 171, in _run_module_as_main "_main_", mod_spec)
File "C:\Python34\lib\runpy.py", line 86, in _run_code exec(code, run_globals)
File "C:\Python34\Scripts\django-admin.exe\_main_.py", line 5, in <module>
File "C:\Python34\lib\site-packages\django\core\management\_init_.py", line 260
subcommands = [*get_commands(), 'help']
SyntaxError: can use starred expression only as assignment target
i had the same problem and i solved by migration to python >= 3.5 , it's an unpacking problem => https://www.python.org/dev/peps/pep-0448/

How do I get started with analyzing XBRL in python?

How do i get started analyzing XBRL data?
I've heard python-xbrl should have some problems, and I'm having difficulties finding documention and examples.
I've heard that Arelle is supposed to be what you want to use. But I simple can't figure out how to install it without getting any weird errors.
I've tried:
1) pip install git+https://github.com/Arelle/Arelle.git
Which returns
error: [Error 3] The system cannot find the path specified: 'c:\\users\\bc0655\\appdata\\local\\temp\\pip- gkza0x- build\\.eggs\\3to2-1.1.1-py2.7.egg\\lib3to2\\fixes/*.*'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in c:\users\bc0655\appdata\local\temp\pip-gkza0x-build\
2) pip install -e git+https://github.com/Arelle/Arelle.git #egg=Arelle
Which returns me:
Exception:
Traceback (most recent call last):
\pip\basecommand.py", line 209, in main status = self.run(options, args)
\pip\commands\install.py", line 287, in run wheel_cache
\pip\basecommand.py", line 270, in populate_requirement_set wheel_cache=wheel_cache
\pip\req\req_install.py", line 230, in from_line wheel_cache=wheel_cache, constraint=constraint)
\pip\req\req_install.py", line 77, in __init__req = pkg_resources.Requirement.parse(req)
\pip\_vendor\pkg_resources\__init__.py", line 3036, in parse req, = parse_requirements(s)
ValueError: need more than 0 values to unpack
3) Install from zip (would like to avoid this)
Returns same errors as 2).
Should I:
Try to figure out why my Arelle installations fails (suggestions / help would be appreciated <3 )
Try another module
Build my system with python-xbrl
try this, it worked for me.
Go to the current path and try using below command
pip install arelle

trigger.io error building "No module named generate_dynamic"

I seem to have a strange error when trying to build my app
Couldn't import generation code: No module named generate_dynamic
What is strange about this error is that I can seem to resolve the error if I uninstall and re-install trigger.io but if I make any changes tot he config the error comes back and I have to uninstall and re-install each time I make a change to the configs. It never used to do this.
Traceback (most recent call last):
File "C:\Users\Michael\AppData\Local\Trigger Toolkit\build-tools\forge\async.py", line 106, in run
result = self._target(*self._args, **self._kwargs)
File "C:\Users\Michael\AppData\Local\Trigger Toolkit\trigger\api\app.py", line 290, in package
build(cookies, path, target)
File "C:\Users\Michael\AppData\Local\Trigger Toolkit\trigger\api\app.py", line 329, in build
forge_main.development_build([target, '--general.interactive', 'no'])
File "C:\Users\Michael\AppData\Local\Trigger Toolkit\build-tools\forge\main.py", line 335, in development_build
manager.fetch_instructions()
File "C:\Users\Michael\AppData\Local\Trigger Toolkit\build-tools\forge\templates.py", line 90, in fetch_instructions
import_generate_dynamic(do_reload=True)
File "C:\Users\Michael\AppData\Local\Trigger Toolkit\build-tools\forge\build.py", line 48, in import_generate_dynamic
raise ForgeError("Couldn't import generation code: {0}".format(e))
ForgeError: Couldn't import generation code: No module named generate_dynamic
That is the debug. Note sure what is going on.
Thanks.
So it looks like its not resolved, I tried to update a module and the whole thing blew up again. I sent the logs to support so we will see how long this will take.
* Edit *
I was able to resolve this by deleting the trigger.Io directory ( the uninstall does not do this ) then reinstalling and importing my project again. Not sure what happened but it's working now
I deleted the .tempalte folder and re-built. Looks like the content of that folder got jacked during a failed or canceled build.

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.