Python django Failed to create a virtualenv - python

I was trying to create a virtual env with python3. But it failed to create new. But the existing virtual env are working fine.
Traceback (most recent call last):
File "C:\Users\DELL\AppData\Local\Programs\Python\Python310\lib\site-packages\virtualenv\seed\embed\via_app_data\via_app_data.py", line 82, in _get
result = get_wheel(
File "C:\Users\DELL\AppData\Local\Programs\Python\Python310\lib\site-packages\virtualenv\seed\wheels\acquire.py", line 23, in get_wheel
wheel = from_bundle(distribution, version, for_py_version, search_dirs, app_data, do_periodic_update, env)
File "C:\Users\DELL\AppData\Local\Programs\Python\Python310\lib\site-packages\virtualenv\seed\wheels\bundle.py", line 17, in from_bundle
wheel = periodic_update(distribution, of_version, for_py_version, wheel, search_dirs, app_data, per, env)
File "C:\Users\DELL\AppData\Local\Programs\Python\Python310\lib\site-packages\virtualenv\seed\wheels\periodic_update.py", line 35, in periodic_update
handle_auto_update(distribution, for_py_version, wheel, search_dirs, app_data, env)
File "C:\Users\DELL\AppData\Local\Programs\Python\Python310\lib\site-packages\virtualenv\seed\wheels\periodic_update.py", line 69, in handle_auto_update
embed_update_log.write(u_log.to_dict())
File "C:\Users\DELL\AppData\Local\Programs\Python\Python310\lib\site-packages\virtualenv\app_data\via_disk_folder.py", line 154, in write
self.file.write_text(json.dumps(content, sort_keys=True, indent=2))
File "C:\Users\DELL\AppData\Local\Programs\Python\Python310\lib\pathlib.py", line 1154, in write_text
with self.open(mode='w', encoding=encoding, errors=errors, newline=newline) as f:
File "C:\Users\DELL\AppData\Local\Programs\Python\Python310\lib\pathlib.py", line 1119, in open
return self._accessor.open(self, mode, buffering, encoding, errors,
PermissionError: [Errno 13] Permission denied: 'C:\\Users\\DELL\\AppData\\Local\\pypa\\virtualenv\\wheel\\3.10\\embed\\3\\pip.json'
fail

Your problem is the permission to write to the folder, which you must give to the Python interpreter
Give admin access to the command line

Related

Scrapy startproject doesn't work Permission denied: spiders

I successfully installed Scrapy.
I created a virtual environment on ubuntu which is on the new windows terminal.
when i try to create a new project i get this error
Traceback (most recent call last):
File "/mnt/d/Scrapy/venv/bin/scrapy", line 8, in <module>
sys.exit(execute())
File "/mnt/d/Scrapy/venv/lib/python3.8/site-packages/scrapy/cmdline.py", line 143, in execute
_run_print_help(parser, _run_command, cmd, args, opts)
File "/mnt/d/Scrapy/venv/lib/python3.8/site-packages/scrapy/cmdline.py", line 98, in _run_print_help
func(*a, **kw)
File "/mnt/d/Scrapy/venv/lib/python3.8/site-packages/scrapy/cmdline.py", line 151, in _run_command
cmd.run(args, opts)
File "/mnt/d/Scrapy/venv/lib/python3.8/site-packages/scrapy/commands/startproject.py", line 110, in run
self._copytree(self.templates_dir, abspath(project_dir))
File "/mnt/d/Scrapy/venv/lib/python3.8/site-packages/scrapy/commands/startproject.py", line 83, in _copytree
self._copytree(srcname, dstname)
File "/mnt/d/Scrapy/venv/lib/python3.8/site-packages/scrapy/commands/startproject.py", line 83, in _copytree
self._copytree(srcname, dstname)
File "/mnt/d/Scrapy/venv/lib/python3.8/site-packages/scrapy/commands/startproject.py", line 88, in _copytree
copystat(src, dst)
File "/usr/lib/python3.8/shutil.py", line 376, in copystat
_copyxattr(src, dst, follow_symlinks=follow)
File "/usr/lib/python3.8/shutil.py", line 326, in _copyxattr
os.setxattr(dst, name, value, follow_symlinks=follow_symlinks)
PermissionError: [Errno 13] Permission denied: '/mnt/d/Scrapy/demo_pro/module/spiders'
Scrapy does some things with file attributes that don't work on a Windows filesystem under WSL.
As a workaround, you could create the project on the WSL filesystem and then copy the result to where you want it. Something along the lines of:
$ cd /tmp
$ scrapy startproject demo_pro
$ cp -r demo_pro /mnt/d/Scrapy

Error when opening Jupyter Notebook from terminal on Mac

I get the following error when trying to open a Jupyter Notebook (using the command jupyter notebook) from the terminal on mac.
Traceback (most recent call last):
File "/Applications/anaconda3/bin/jupyter-notebook", line 11, in <module>
sys.exit(main())
File "/anaconda3/lib/python3.6/site-packages/jupyter_core/application.py", line 266, in launch_instance
return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
File "/anaconda3/lib/python3.6/site-packages/traitlets/config/application.py", line 657, in launch_instance
app.initialize(argv)
File "<decorator-gen-7>", line 2, in initialize
File "/anaconda3/lib/python3.6/site-packages/traitlets/config/application.py", line 87, in catch_config_error
return method(app, *args, **kwargs)
File "/anaconda3/lib/python3.6/site-packages/notebook/notebookapp.py", line 1531, in initialize
super(NotebookApp, self).initialize(argv)
File "<decorator-gen-6>", line 2, in initialize
File "/anaconda3/lib/python3.6/site-packages/traitlets/config/application.py", line 87, in catch_config_error
return method(app, *args, **kwargs)
File "/anaconda3/lib/python3.6/site-packages/jupyter_core/application.py", line 242, in initialize
self.migrate_config()
File "/anaconda3/lib/python3.6/site-packages/jupyter_core/application.py", line 168, in migrate_config
migrate()
File "/anaconda3/lib/python3.6/site-packages/jupyter_core/migrate.py", line 247, in migrate
with open(os.path.join(env['jupyter_config'], 'migrated'), 'w') as f:
PermissionError: [Errno 13] Permission denied: '/Users/Mridula/.jupyter/migrated'
I have tried to uninstall and re-install. I still face the same error. I have tried to clear the bash profile, to no avail.
Any help would be highly welcome and appreciated.
Best,
Mridula
I'm summarizing our conversations here as it helped you to resolve the problem.
There could be many possible options to address this issue. However, the very first approach to tackle this problem is to resolve permission issues. The last line of your error message is PermissionError: [Errno 13] Permission denied: '/Users/Mridula/.jupyter/migrated' which means you don't have the right permission to access the .jupyter directory.
Change file permission
sudo chmod -R 755 /Users/Mridula/.jupyter/
If this doesn't help then do the following steps
uninstall Anaconda
remove .jupyter directory from your user
install a fresh copy of Anaconda
Hope it helps!

Permission Denied while trying to run a Python package

I'm trying to use a Python package called csvkit on an AWS EC2 machine. I was able to install it after some hiccups, which might be related - running pip install csvkit threw an error at
with open(path, 'rb') as stream:
IOERROR: [Errno 13] Permission denied: '/usr/local/lib/python2.7/site-packages/python_dateutil-2.2-py2.7.egg/EGG-INFO/requires.txt'
But I was able to install it with some other command.
Now onto the original problem - when I try to run a simple function within the csvkit package like cavstat, this is the full error output:
[username ~]$ csvstat
Traceback (most recent call last):
File "/usr/local/bin/csvstat", line 5, in <module>
from pkg_resources import load_entry_point
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3020, in <module>
working_set = WorkingSet._build_master()
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 614, in _build_master
ws.require(__requires__)
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 920, in require
needed = self.resolve(parse_requirements(requirements))
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 815, in resolve
new_requirements = dist.requires(req.extras)[::-1]
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2552, in requires
dm = self._dep_map
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2537, in _dep_map
for extra, reqs in split_sections(self._get_metadata(name)):
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2978, in split_sections
for line in yield_lines(s):
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2252, in yield_lines
for ss in strs:
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2566, in _get_metadata
for line in self.get_metadata_lines(name):
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 1589, in get_metadata_lines
return yield_lines(self.get_metadata(name))
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 1581, in get_metadata
return self._get(self._fn(self.egg_info, name))
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 1692, in _get
with open(path, 'rb') as stream:
IOError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/site-packages/python_dateutil-2.2-py2.7.egg/EGG-INFO/requires.txt'
I'm not sure what to even search to see what's the issue. Is this related to date-utils?
I'm fairly new to the Linux world, so editing configuration files and whatnot is a bit difficult for me.
If you're doing a system-wide install via 'pip install csvkit', you'll need sudo privileges for the current user, which is why the install process has borked on modifying the /usr/local/lib/python2.7 structure.
If you're on an AWS instance you've created, sudo privileges should be pretty straightforward to set up for your current user.
If you're looking for a more contained alternative, you could install virtualenv and set up an isolated virtualenv (https://virtualenv.pypa.io/en/latest/installation.html) but virtualenv might be overkill for a throwaway server.
Does that help at all?

virtualenvwrapper - IOError: [Errno 13] Permission denied

I'm trying to install virtualenvwrapper on a fresh Ubuntu 14.04 installation. I followed the steps here and added these lines to my .bashrc:
export WORKON_HOME=$HOME/.virtualenvs
export PROJECT_HOME=$HOME/Devel
source /usr/local/bin/virtualenvwrapper.sh
I get the following error message when I try and source ~/.bashrc:
Traceback (most recent call last):
File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/usr/local/lib/python2.7/dist-packages/virtualenvwrapper/hook_loader.py", line 217, in <module>
main()
File "/usr/local/lib/python2.7/dist-packages/virtualenvwrapper/hook_loader.py", line 131, in main
run_hooks(hook, options, args)
File "/usr/local/lib/python2.7/dist-packages/virtualenvwrapper/hook_loader.py", line 157, in run_hooks
hook_mgr = ExtensionManager(namespace)
File "/usr/local/lib/python2.7/dist-packages/stevedore/extension.py", line 92, in __init__
verify_requirements)
File "/usr/local/lib/python2.7/dist-packages/stevedore/extension.py", line 155, in _load_plugins
for ep in self._find_entry_points(self.namespace):
File "/usr/local/lib/python2.7/dist-packages/stevedore/extension.py", line 148, in _find_entry_points
eps = list(pkg_resources.iter_entry_points(namespace))
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 515, in iter_entry_points
entries = dist.get_entry_map(group)
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2371, in get_entry_map
self._get_metadata('entry_points.txt'), self
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2155, in parse_map
for group, lines in data:
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2715, in split_sections
for line in yield_lines(s):
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1989, in yield_lines
for ss in strs:
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2305, in _get_metadata
for line in self.get_metadata_lines(name):
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1369, in get_metadata_lines
return yield_lines(self.get_metadata(name))
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1361, in get_metadata
return self._get(self._fn(self.egg_info,name))
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1470, in _get
stream = open(path, 'rb')
IOError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/numpydoc-0.4-py2.7.egg/EGG-INFO/entry_points.txt'
virtualenvwrapper.sh: There was a problem running the initialization hooks.
If Python could not import the module virtualenvwrapper.hook_loader,
check that virtualenv has been installed for
VIRTUALENVWRAPPER_PYTHON=/usr/bin/python and that PATH is
set properly.
This happens when source /usr/local/bin/virtualenvwrapper.sh is executed.
Any ideas? Thanks.
EDIT: Although I am getting this error message, it seems my virtualenv is kind of working. I am able to create new env and even workon them. But every command I ttype, I get the IOError above.
Fixed. I just uninstalled the offending numpy doc package:
sudo pip uninstall numpydoc

virtualenvwrapper issues on cygwin using python3.4 (installed using standalone installer)

I'm having issues with virtualenv wrapper, I receive the below error when I run:
source /cygdrive/c/Python34/Scripts/virtualenvwrapper.sh
I've run
which python <- shows correct path
which virtualenvwrapper.sh <- shows correct path
which virtualenv <- shows correct path
Error:
>$ source /cygdrive/c/Python34/Scripts/virtualenvwrapper.sh
stevedore.extension error calling 'project': [Errno 2] No such file or directory : 'C:\\home\\kolafsson\\.virtualenvs\\premkproject'
stevedore.extension [Errno 2] No such file or directory: 'C:\\home\\kolafsson\\. virtualenvs\\premkproject'
Traceback (most recent call last):
File "C:\Python34\lib\site-packages\stevedore-0.15-py3.4.egg\stevedore\extensi on.py", line 248, in _invoke_one_plugin
response_callback(func(e, *args, **kwds))
File "C:\Python34\lib\site-packages\virtualenvwrapper-4.2-py3.4.egg\virtualenv wrapper\hook_loader.py", line 185, in invoke
File "C:\Python34\lib\site-packages\virtualenvwrapper-4.2-py3.4.egg\virtualenv wrapper\project.py", line 30, in initialize
comment)
File "C:\Python34\lib\site-packages\virtualenvwrapper-4.2-py3.4.egg\virtualenv wrapper\user_scripts.py", line 124, in make_hook
f = open(filename, 'w')
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\home\\kolafsson\\.v irtualenvs\\premkproject'
stevedore.extension error calling 'user_scripts': [Errno 2] No such file or dire ctory: 'C:\\home\\kolafsson\\.virtualenvs\\initialize'
stevedore.extension [Errno 2] No such file or directory: 'C:\\home\\kolafsson\\. virtualenvs\\initialize'
Traceback (most recent call last):
File "C:\Python34\lib\site-packages\stevedore-0.15-py3.4.egg\stevedore\extensi on.py", line 248, in _invoke_one_plugin
response_callback(func(e, *args, **kwds))
File "C:\Python34\lib\site-packages\virtualenvwrapper-4.2-py3.4.egg\virtualenv wrapper\hook_loader.py", line 185, in invoke
File "C:\Python34\lib\site-packages\virtualenvwrapper-4.2-py3.4.egg\virtualenv wrapper\user_scripts.py", line 141, in initialize
make_hook(get_path('$VIRTUALENVWRAPPER_HOOK_DIR', filename), comment)
File "C:\Python34\lib\site-packages\virtualenvwrapper-4.2-py3.4.egg\virtualenv wrapper\user_scripts.py", line 124, in make_hook
f = open(filename, 'w')
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\home\\kolafsson\\.v irtualenvs\\initialize'
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\lib\site-packages\virtualenvwrapper-4.2-py3.4.egg\virtualenv wrapper\hook_loader.py", line 217, in <module>
File "C:\Python34\lib\site-packages\virtualenvwrapper-4.2-py3.4.egg\virtualenv wrapper\hook_loader.py", line 137, in main
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/virtualenvwrapper- initialize-hook-Kxjb02CrwN'
virtualenvwrapper.sh: There was a problem running the initialization hooks.
If Python could not import the module virtualenvwrapper.hook_loader,
check that virtualenv has been installed for
VIRTUALENVWRAPPER_PYTHON=/cygdrive/c/Python34/python and that PATH is
set properly.
Does anyone know what is causing this error and how I could fix it?
Problems I had were due to the permissions on the virtualenv directory not being correct. The had root when I needed the local user.
which here might be 'C:\\home\\kolafsson\\.v....

Categories