I am new in Python and to be coder :) I am trying to create and active virtualenv, searching for days to fix this problem but I couldn't, can you help me pls..
Thank you.
Let me show you my administrator:
Using base prefix 'c:\\users\\büşra\\appdata\\local\\programs\\python\\python37'
New python executable in C:\Users\Büşra\Desktop\Django-Virtualenv\myenv\Scripts\python.exe
Complete output from command C:\Users\Büşra\Deskt...v\Scripts\python.exe -m pip config list:
Could not import runpy module
ModuleNotFoundError: No module named 'runpy'
----------------------------------------
Traceback (most recent call last):
File "c:\users\büşra\appdata\local\programs\python\python37\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "c:\users\büşra\appdata\local\programs\python\python37\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\Büşra\AppData\Local\Programs\Python\Python37\Scripts\virtualenv.exe\__main__.py", line 9, in <module>
File "c:\users\büşra\appdata\local\programs\python\python37\lib\site-packages\virtualenv.py", line 793, in main
symlink=options.symlink,
File "c:\users\büşra\appdata\local\programs\python\python37\lib\site-packages\virtualenv.py", line 1087, in create_environment
install_wheel(to_install, py_executable, search_dirs, download=download)
File "c:\users\büşra\appdata\local\programs\python\python37\lib\site-packages\virtualenv.py", line 935, in install_wheel
_install_wheel_with_search_dir(download, project_names, py_executable, search_dirs)
File "c:\users\büşra\appdata\local\programs\python\python37\lib\site-packages\virtualenv.py", line 964, in _install_wheel_with_search_dir
config = _pip_config(py_executable, python_path)
File "c:\users\büşra\appdata\local\programs\python\python37\lib\site-packages\virtualenv.py", line 1038, in _pip_config
remove_from_env=["PIP_VERBOSE", "PIP_QUIET"],
File "c:\users\büşra\appdata\local\programs\python\python37\lib\site-packages\virtualenv.py", line 886, in call_subprocess
raise OSError("Command {} failed with error code {}".format(cmd_desc, proc.returncode))
OSError: Command C:\Users\Büşra\Deskt...v\Scripts\python.exe -m pip config list failed with error code 1```
On a windows machine you would activate the virtual environment as follows:
cd into the project directory, if your virtual environment is named venv then this
venv\scripts\activate will activate the virtual environment
Related
I am trying to create a new virtual environment using python on Windows 10.The command sets up the folders/subfolder but does not include the necessary scripts to activate the environment.(The folder is empty).
Stack Trace:
C:\Users\mcfry\Documents\Development\Django_Dev\django_test>python3 -m virtualenv my_env
Using base prefix 'C:\\Program Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.7_3.7.1520.0_x64__qbz5n2kfra8p0'
New python executable in C:\Users\mcfry\Documents\Development\Django_Dev\django_test\my_env\Scripts\python.exe
Traceback (most recent call last):
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.1520.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.1520.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\mcfry\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\virtualenv.py", line 2632, in <module>
main()
File "C:\Users\mcfry\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\virtualenv.py", line 870, in main
symlink=options.symlink,
File "C:\Users\mcfry\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\virtualenv.py", line 1156, in create_environment
install_python(home_dir, lib_dir, inc_dir, bin_dir, site_packages=site_packages, clear=clear, symlink=symlink)
File "C:\Users\mcfry\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\virtualenv.py", line 1526, in install_python
shutil.copyfile(executable, py_executable)
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.1520.0_x64__qbz5n2kfra8p0\lib\shutil.py", line 120, in copyfile
with open(src, 'rb') as fsrc:
OSError: [Errno 22] Invalid argument: 'C:\\Users\\mcfry\\AppData\\Local\\Microsoft\\WindowsApps\\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\\python.exe'
The command you are using is invalid.
Use the following command:
python3 -m venv myenv
or, if you are using virtualenv package, use the following:
virtualenv myenv
Find more details here : Python venv Python virtualenv
I have an Error while creating virtual environmenr on Python 3.73 in Windows 7.
During creation of new virtual environment I am getting error like below.
Can somebody help me with this. I have already searched tonns of info and nothing helps me out.
Thanks in advance
Using base prefix 'C:\\Users\\Саша\\AppData\\Local\\Programs\\Python\\Python37-32'
New python executable in C:\Users\Саша\myenv\Scripts\python.exe
Command C:\Users\Саша\myenv\Scripts\python.exe -m pip config list had error code 1
Installing setuptools, pip, wheel...
Complete output from command C:\Users\Саша\myenv\Scripts\python.exe - setuptools pip wheel:
Traceback (most recent call last):
File "<stdin>", line 3, in <module>
ModuleNotFoundError: No module named 'pkgutil'
----------------------------------------
...Installing setuptools, pip, wheel...done.
Traceback (most recent call last):
File "C:\Users\Саша\AppData\Local\Programs\Python\Python37-32\lib\runpy.py", line 193, in _run_module_as
"__main__", mod_spec)
File "C:\Users\Саша\AppData\Local\Programs\Python\Python37-32\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\Саша\AppData\Roaming\Python\Python37\site-packages\virtualenv.py", line 2635, in <module>
main()
File "C:\Users\Саша\AppData\Roaming\Python\Python37\site-packages\virtualenv.py", line 870, in main
symlink=options.symlink,
File "C:\Users\Саша\AppData\Roaming\Python\Python37\site-packages\virtualenv.py", line 1173, in create_e
install_wheel(to_install, py_executable, search_dirs, download=download)
File "C:\Users\Саша\AppData\Roaming\Python\Python37\site-packages\virtualenv.py", line 1019, in install_
_install_wheel_with_search_dir(download, project_names, py_executable, search_dirs)
File "C:\Users\Саша\AppData\Roaming\Python\Python37\site-packages\virtualenv.py", line 1110, in _install
arch_dir
call_subprocess(cmd, show_stdout=False, extra_env=env, stdin=script)
File "C:\Users\Саша\AppData\Roaming\Python\Python37\site-packages\virtualenv.py", line 963, in call_subp
raise OSError("Command {} failed with error code {}".format(cmd_desc, proc.returncode))
OSError: Command C:\Users\Саша\myenv\Scripts\python.exe - setuptools pip wheel failed with error code 1
Try it with removing python to 'c:\python37' from appdata. It cuz you have unicode chars in the path name.
This question already has answers here:
What's the bad magic number error?
(15 answers)
Closed 4 years ago.
Take it easy, I'm a n00b. I get this error when I'm trying to initialize an environment to get a project going. I've scoured through many stack overflow and GitHub (Usage/request) before I decided to post here. I updated pipenv and even updated by python up to 3.7 from 3.6. I've been at it for 2 hours but I decided I may need your help.
pipenv run python3
Creating a virtualenv for this project…
Pipfile: /home/user1/Pipfile
Using /usr/bin/python3 (3.6.7) to create virtualenv…
⠙ Creating virtual environment...
✘ Failed creating virtual environment
[pipenv.exceptions.VirtualenvCreationException]: File "/home/user1/.local/lib/python3.6/site-packages/pipenv/cli/command.py", line 408, in run
[pipenv.exceptions.VirtualenvCreationException]: command=command, args=args, three=state.three, python=state.python, pypi_mirror=state.pypi_mirror
[pipenv.exceptions.VirtualenvCreationException]: File "/home/user1/.local/lib/python3.6/site-packages/pipenv/core.py", line 2310, in do_run
[pipenv.exceptions.VirtualenvCreationException]: three=three, python=python, validate=False, pypi_mirror=pypi_mirror,
[pipenv.exceptions.VirtualenvCreationException]: File "/home/user1/.local/lib/python3.6/site-packages/pipenv/core.py", line 574, in ensure_project
[pipenv.exceptions.VirtualenvCreationException]: pypi_mirror=pypi_mirror,
[pipenv.exceptions.VirtualenvCreationException]: File "/home/user1/.local/lib/python3.6/site-packages/pipenv/core.py", line 506, in ensure_virtualenv
[pipenv.exceptions.VirtualenvCreationException]: python=python, site_packages=site_packages, pypi_mirror=pypi_mirror
[pipenv.exceptions.VirtualenvCreationException]: File "/home/user1/.local/lib/python3.6/site-packages/pipenv/core.py", line 935, in do_create_virtualenv
[pipenv.exceptions.VirtualenvCreationException]: extra=[crayons.blue("{0}".format(c.err)),]
[pipenv.exceptions.VirtualenvCreationException]: Traceback (most recent call last):
File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/home/user1/.local/lib/python3.6/site-packages/virtualenv.py", line 26, in <module>
import logging
ImportError: bad magic number in 'logging': b'\x03\xf3\r\n'
Error in sys.excepthook:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook
from apport.fileutils import likely_packaged, get_recent_crashes
File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in <module>
from apport.report import Report
File "/usr/lib/python3/dist-packages/apport/report.py", line 30, in <module>
import apport.fileutils
File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 23, in <module>
from apport.packaging_impl import impl as packaging
File "/usr/lib/python3/dist-packages/apport/packaging_impl.py", line 24, in <module>
import apt
File "/usr/lib/python3/dist-packages/apt/__init__.py", line 26, in <module>
from apt.package import Package
File "/usr/lib/python3/dist-packages/apt/package.py", line 24, in <module>
import logging
ImportError: bad magic number in 'logging': b'\x03\xf3\r\n'
Original exception was:
Traceback (most recent call last):
File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/home/user1/.local/lib/python3.6/site-packages/virtualenv.py", line 26, in <module>
import logging
ImportError: bad magic number in 'logging': b'\x03\xf3\r\n'
Failed to create virtual environ
ment.
I think the standalone version is broken, its working for me within an existing venv
(test_123) conor#xxxxxxx:~/workspace/django-machina$ make init
pipenv install --three --dev
Courtesy Notice: Pipenv found itself running within a virtual environment, so it will automatically use that environment, instead of creating its own for any project. You can set PIPENV_IGNORE_VIRTUALENVS=1 to force pipenv to ignore that environment and create its own instead. You can set PIPENV_VERBOSITY=-1 to suppress this warning.
Installing dependencies from Pipfile.lock (02d410)…
Ignoring appnope: markers 'sys_platform == "darwin"' don't match your environment
Looking in indexes: https://pypi.python.org/simple
🐍 ▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 75/75 — 00
When I run mlflow ui the following error occurred:
Traceback (most recent call last):
File "c:\anaconda3\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "c:\anaconda3\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Anaconda3\Scripts\gunicorn.exe\__main__.py", line 5, in <module>
File "c:\anaconda3\lib\site-packages\gunicorn\app\wsgiapp.py", line 9, in <module>
from gunicorn.app.base import Application
File "c:\anaconda3\lib\site-packages\gunicorn\app\base.py", line 12, in <module>
from gunicorn import util
File "c:\anaconda3\lib\site-packages\gunicorn\util.py", line 9, in <module>
import fcntl
ModuleNotFoundError: No module named 'fcntl'
Traceback (most recent call last):
File "c:\anaconda3\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "c:\anaconda3\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Anaconda3\Scripts\mlflow.exe\__main__.py", line 9, in <module>
File "c:\anaconda3\lib\site-packages\click\core.py", line 722, in __call__
return self.main(*args, **kwargs)
File "c:\anaconda3\lib\site-packages\click\core.py", line 697, in main
rv = self.invoke(ctx)
File "c:\anaconda3\lib\site-packages\click\core.py", line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "c:\anaconda3\lib\site-packages\click\core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "c:\anaconda3\lib\site-packages\click\core.py", line 535, in invoke
return callback(*args, **kwargs)
File "c:\anaconda3\lib\site-packages\mlflow\cli.py", line 131, in ui
mlflow.server._run_server(file_store, file_store, host, port, 1)
File "c:\anaconda3\lib\site-packages\mlflow\server\__init__.py", line 48, in _run_server
env=env_map, stream_output=True)
File "c:\anaconda3\lib\site-packages\mlflow\utils\process.py", line 38, in exec_cmd
raise ShellCommandException("Non-zero exitcode: %s" % (exit_code))
mlflow.utils.process.ShellCommandException: Non-zero exitcode: 1
I used anaconda + python 3.6.5 and I installed git and set path with C:\Program Files\Git\bin\git.exe and C:\Program Files\Git\cmd.
I installed mlflow whit pip install mlflow and its version is 0.2.1.
I set a variable with name GIT_PYTHON_GIT_EXECUTABLE and value C:\Program Files\Git\bin\git.exe in Environment Variables.
How can I solve this?
firstly Uninstall 'mlflow' and 'waitress', then again install 'mlflow' .Now try it works
mlflow documentation already says that
Note 2: We do not currently support running MLflow on Windows.
Despite this, we would appreciate any contributions to make MLflow
work better on Windows.
You're hitting fcntl problem: it's not available on MS Windows platform because it's a "wrapper" around the fcntl function that's available on POSIX-compatible systems. (See https://stackoverflow.com/a/1422436/236007 for more details.)
Solving this requires modifying the source code of mlflow accordingly.
Following the Flask 0.11 documentation, I cloned the Flask repo, created a virtualenv, and installed Flask via pip install flask. I went into the examples/flaskr directory, set the FLASK_APP environment variable, then executed:
flask run
However, I got the following error:
Traceback (most recent call last):
File "c:\python34\Lib\runpy.py", line 170, in _run_module_as_main
"__main__", mod_spec)
File "c:\python34\Lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "D:\GitHub\flask\venv\Scripts\flask.exe\__main__.py", line 9, in <module>
File "d:\github\flask\venv\lib\site-packages\flask\cli.py", line 478, in main
cli.main(args=args, prog_name=name)
File "d:\github\flask\venv\lib\site-packages\flask\cli.py", line 345, in main
return AppGroup.main(self, *args, **kwargs)
File "d:\github\flask\venv\lib\site-packages\click\core.py", line 696, in main
rv = self.invoke(ctx)
File "d:\github\flask\venv\lib\site-packages\click\core.py", line 1055, in invoke
cmd_name, cmd, args = self.resolve_command(ctx, args)
File "d:\github\flask\venv\lib\site-packages\click\core.py", line 1094, in resolve_command
cmd = self.get_command(ctx, cmd_name)
File "d:\github\flask\venv\lib\site-packages\flask\cli.py", line 316, in get_command
rv = info.load_app().cli.get_command(ctx, name)
File "d:\github\flask\venv\lib\site-packages\flask\cli.py", line 209, in load_app
rv = locate_app(self.app_import_path)
File "d:\github\flask\venv\lib\site-packages\flask\cli.py", line 89, in locate_app
__import__(module)
ImportError: No module named 'flaskr'
How do I correctly run the flaskr example?
I was setting FLASK_APP=flaskr. Since I hadn't installed my app as a package in my virtualenv, I needed to add the .py extension.
export FLASK_APP=flaskr.py
Flask issue for the eclipse and PyDev extension, you can set a path like this.
Flask 1.0.2 and Python 3.6 already installed on Windows 10.
flask.cli.NoAppException
flask.cli.NoAppException: module 'src' has no attribute 'Hello'
Run Flask in proper folder path to resolve this issue.