C:\Users\Home\Desktop\CSS3\harward\files\src2\variables0>flask run
* Environment: production
WARNING: This is a development server. Do not use it in a production deployment.
Use a production WSGI server instead.
* Debug mode: off
Traceback (most recent call last):
File "c:\program files\python38\lib\runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,`enter code here`
File "c:\program files\python38\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "C:\Program Files\Python38\Scripts\flask.exe\__main__.py", line 9, in <module>
File "c:\program files\python38\lib\site-packages\flask\cli.py", line 967, in main
cli.main(args=sys.argv[1:], prog_name="python -m flask" if as_module else None)
File "c:\program files\python38\lib\site-packages\flask\cli.py", line 586, in main
return super(FlaskGroup, self).main(*args, **kwargs)
File "c:\program files\python38\lib\site-packages\click\core.py", line 782, in main
rv = self.invoke(ctx)
File "c:\program files\python38\lib\site-packages\click\core.py", line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "c:\program files\python38\lib\site-packages\click\core.py", line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "c:\program files\python38\lib\site-packages\click\core.py", line 610, in invoke
return callback(*args, **kwargs)
File "c:\program files\python38\lib\site-packages\click\decorators.py", line 73, in new_func
return ctx.invoke(f, obj, *args, **kwargs)
File "c:\program files\python38\lib\site-packages\click\core.py", line 610, in invoke
return callback(*args, **kwargs)
File "c:\program files\python38\lib\site-packages\flask\cli.py", line 852, in run_command
run_simple(
File "c:\program files\python38\lib\site-packages\werkzeug\serving.py", line 1052, in run_simple
inner()
File "c:\program files\python38\lib\site-packages\werkzeug\serving.py", line 996, in inner
srv = make_server(
File "c:\program files\python38\lib\site-packages\werkzeug\serving.py", line 847, in make_server
return ThreadedWSGIServer(
File "c:\program files\python38\lib\site-packages\werkzeug\serving.py", line 740, in __init__
HTTPServer.__init__(self, server_address, handler)
File "c:\program files\python38\lib\socketserver.py", line 452, in __init__
self.server_bind()
File "c:\program files\python38\lib\http\server.py", line 138, in server_bind
socketserver.TCPServer.server_bind(self)
File "c:\program files\python38\lib\socketserver.py", line 466, in server_bind
self.socket.bind(self.server_address)
OSError: [WinError 10013] An attempt was made to access a socket in a way forbidden by its access permissions
I faced this issue in the virtual environment, so this is what I did:
I deactivated virtualenv and installed flask there
I activated the virtualenv and installed flask again and it worked.
I faced this on windows10
Related
Currently trying to install django 2.1 in my command prompt through pipenv command. However there's an error where it says Pipfile access denied.
C:\windows\system32>pipenv install django==2.1
Traceback (most recent call last):
File "c:\users\lenovo\appdata\local\programs\python\python38-32\lib\runpy.py",
line 193, in _run_module_as_main
return _run_code(code, main_globals, None,
File "c:\users\lenovo\appdata\local\programs\python\python38-32\lib\runpy.py",
line 86, in _run_code
exec(code, run_globals)
File "C:\Users\lenovo\AppData\Local\Programs\Python\Python38-32\Scripts\pipenv
.exe\__main__.py", line 9, in <module>
File "C:\Users\lenovo\AppData\Local\Programs\Python\Python38-32\Lib\site-packa
ges\pipenv\vendor\click\core.py", line 764, in __call__
return self.main(*args, **kwargs)
File "C:\Users\lenovo\AppData\Local\Programs\Python\Python38-32\Lib\site-packa
ges\pipenv\vendor\click\core.py", line 717, in main
rv = self.invoke(ctx)
File "C:\Users\lenovo\AppData\Local\Programs\Python\Python38-32\Lib\site-packa
ges\pipenv\vendor\click\core.py", line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "C:\Users\lenovo\AppData\Local\Programs\Python\Python38-32\Lib\site-packa
ges\pipenv\vendor\click\core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "C:\Users\lenovo\AppData\Local\Programs\Python\Python38-32\Lib\site-packa
ges\pipenv\vendor\click\core.py", line 555, in invoke
return callback(*args, **kwargs)
File "C:\Users\lenovo\AppData\Local\Programs\Python\Python38-32\Lib\site-packa
ges\pipenv\vendor\click\decorators.py", line 64, in new_func
return ctx.invoke(f, obj, *args, **kwargs)
File "C:\Users\lenovo\AppData\Local\Programs\Python\Python38-32\Lib\site-packa
ges\pipenv\vendor\click\core.py", line 555, in invoke
return callback(*args, **kwargs)
File "C:\Users\lenovo\AppData\Local\Programs\Python\Python38-32\Lib\site-packa
ges\pipenv\vendor\click\decorators.py", line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File "c:\users\lenovo\appdata\local\programs\python\python38-32\lib\site-packa
ges\pipenv\cli\command.py", line 235, in install
retcode = do_install(
File "c:\users\lenovo\appdata\local\programs\python\python38-32\lib\site-packa
ges\pipenv\core.py", line 1734, in do_install
ensure_project(
File "c:\users\lenovo\appdata\local\programs\python\python38-32\lib\site-packa
ges\pipenv\core.py", line 567, in ensure_project
project.touch_pipfile()
File "c:\users\lenovo\appdata\local\programs\python\python38-32\lib\site-packa
ges\pipenv\project.py", line 677, in touch_pipfile
with open("Pipfile", "a"):
PermissionError: [Errno 13] Permission denied: 'Pipfile'
I'm new. I'm in the process of learning on how to build a website.
You need to run the command prompt as an administrator. If you don't know how to do this, a shortcut is to do WIN + x and then press A when a menu shows.
I run pip install streamlit and succesfully install streamlit.
However, when I run streamlit hello or streamlit run app.py where app.py is a python app where I import streamlit, I get the following error.
$ streamlit hello
Traceback (most recent call last):
File "c:\program files (x86)\python37-32\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "c:\program files (x86)\python37-32\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Program Files (x86)\Python37-32\Scripts\streamlit.exe\__main__.py", line 7, in <module>
File "c:\program files (x86)\python37-32\lib\site-packages\click\core.py", line 764, in __call__
return self.main(*args, **kwargs)
File "c:\program files (x86)\python37-32\lib\site-packages\click\core.py", line 717, in main
rv = self.invoke(ctx)
File "c:\program files (x86)\python37-32\lib\site-packages\click\core.py", line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "c:\program files (x86)\python37-32\lib\site-packages\click\core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "c:\program files (x86)\python37-32\lib\site-packages\click\core.py", line 555, in invoke
return callback(*args, **kwargs)
File "c:\program files (x86)\python37-32\lib\site-packages\streamlit\cli.py", line 192, in main_hello
_main_run(filename)
File "c:\program files (x86)\python37-32\lib\site-packages\streamlit\cli.py", line 251, in _main_run
bootstrap.run(file, command_line, args)
File "c:\program files (x86)\python37-32\lib\site-packages\streamlit\bootstrap.py", line 221, in run
server.start(_on_server_start)
File "c:\program files (x86)\python37-32\lib\site-packages\streamlit\server\Server.py", line 213, in start
start_listening(app)
File "c:\program files (x86)\python37-32\lib\site-packages\streamlit\server\Server.py", line 122, in start_listening
app.listen(port)
File "c:\program files (x86)\python37-32\lib\site-packages\tornado\web.py", line 2042, in listen
server.listen(port, address)
File "c:\program files (x86)\python37-32\lib\site-packages\tornado\tcpserver.py", line 143, in listen
sockets = bind_sockets(port, address=address)
File "c:\program files (x86)\python37-32\lib\site-packages\tornado\netutil.py", line 168, in bind_sockets
sock.bind(sockaddr)
OSError: [WinError 10013] An attempt was made to access a socket in a way forbidden by its access permissions
I have tried to disable firewall but still got the error persists. I have also tried running streamlit run app.py --browser.serverPort 3000 and still got the same error.
I think the option is not --browser.serverPort but --server.port:
streamlit run your_script.py --server.port 3000
Flask app that I run on windows I have not changed any since it was last functioning. and now I'm seeing this error which I don't understand why its occuring.
Trackback when I try to run the app:
flask run -host=0.0.0.0
* Serving Flask app "predict_app.py"
* Environment: production
WARNING: Do not use the development server in a production environment.
Use a production WSGI server instead.
* Debug mode: off
Using TensorFlow backend.
2018-11-29 12:56:44.685154: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX
Traceback (most recent call last):
File "c:\programdata\anaconda3\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "c:\programdata\anaconda3\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\ProgramData\Anaconda3\Scripts\flask.exe\__main__.py", line 9, in <module>
File "c:\programdata\anaconda3\lib\site-packages\flask\cli.py", line 894, in main
cli.main(args=args, prog_name=name)
File "c:\programdata\anaconda3\lib\site-packages\flask\cli.py", line 557, in main
return super(FlaskGroup, self).main(*args, **kwargs)
File "c:\programdata\anaconda3\lib\site-packages\click\core.py", line 717, in main
rv = self.invoke(ctx)
File "c:\programdata\anaconda3\lib\site-packages\click\core.py", line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "c:\programdata\anaconda3\lib\site-packages\click\core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "c:\programdata\anaconda3\lib\site-packages\click\core.py", line 555, in invoke
return callback(*args, **kwargs)
File "c:\programdata\anaconda3\lib\site-packages\click\decorators.py", line 64, in new_func
return ctx.invoke(f, obj, *args, **kwargs)
File "c:\programdata\anaconda3\lib\site-packages\click\core.py", line 555, in invoke
return callback(*args, **kwargs)
File "c:\programdata\anaconda3\lib\site-packages\flask\cli.py", line 771, in run_command
threaded=with_threads, ssl_context=cert)
File "c:\programdata\anaconda3\lib\site-packages\werkzeug\serving.py", line 814, in run_simple
inner()
File "c:\programdata\anaconda3\lib\site-packages\werkzeug\serving.py", line 774, in inner
fd=fd)
File "c:\programdata\anaconda3\lib\site-packages\werkzeug\serving.py", line 660, in make_server
passthrough_errors, ssl_context, fd=fd)
File "c:\programdata\anaconda3\lib\site-packages\werkzeug\serving.py", line 577, in __init__
self.address_family), handler)
File "c:\programdata\anaconda3\lib\socketserver.py", line 453, in __init__
self.server_bind()
File "c:\programdata\anaconda3\lib\http\server.py", line 136, in server_bind
socketserver.TCPServer.server_bind(self)
File "c:\programdata\anaconda3\lib\socketserver.py", line 467, in server_bind
self.socket.bind(self.server_address)
socket.gaierror: [Errno 11001] getaddrinfo failed
From flask docs:
If you have the debugger disabled or trust the users on your network, you can make the server publicly available simply by adding --host=0.0.0.0 to the command line:
So use --host instead of -host:
flask run --host=0.0.0.0
I'm a Mac user, and I frequently face frustrations when installing python packages.
This time, pipenv seems not working properly.
I successfully installed pipenv.
$pipenv --version
pipenv, version 11.10.1
However, When I try to init pipenv shell, I got error like this:
Creating a virtualenv for this project…
Using /Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6 (3.6.4) to create virtualenv…
⠋Already using interpreter /Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6
Using base prefix '/Library/Frameworks/Python.framework/Versions/3.6'
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/virtualenv.py", line 2349, in <module>
main()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/virtualenv.py", line 712, in main
symlink=options.symlink)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/virtualenv.py", line 927, in create_environment
site_packages=site_packages, clear=clear, symlink=symlink))
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/virtualenv.py", line 1140, in install_python
copy_required_modules(home_dir, symlink)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/virtualenv.py", line 1070, in copy_required_modules
dst_filename = change_prefix(filename, dst_prefix)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/virtualenv.py", line 1044, in change_prefix
(filename, prefixes)
AssertionError: Filename /Users/ChaewonKong/Desktop/dev/re.py does not start with any of these prefixes: ['/Library/Frameworks/Python.framework/Versions/3.6/Extras/lib/python', '/Users/ChaewonKong/Library/Python/3.6/lib/python/site-packages', '/Users/ChaewonKong/.local/lib/python/3.6/site-packages', '/Users/ChaewonKong/Library/Python/3.6/site-packages', '/Library/Frameworks/Python.framework/Versions/3.6', '/Library/Frameworks/Python.framework/Versions/3.6', '/Library/Python/3.6/site-packages']
Virtualenv location:
Creating a Pipfile for this project…
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.6/bin/pipenv", line 11, in <module>
sys.exit(cli())
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 722, in __call__
return self.main(*args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pipenv/cli.py", line 607, in shell
three=three, python=python, fancy=fancy, shell_args=shell_args
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pipenv/core.py", line 2149, in do_shell
ensure_project(three=three, python=python, validate=False)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pipenv/core.py", line 648, in ensure_project
ensure_pipfile(validate=validate, skip_requirements=skip_requirements, system=system)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pipenv/core.py", line 302, in ensure_pipfile
project.create_pipfile(python=python)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pipenv/project.py", line 588, in create_pipfile
required_python = self.which('python')
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pipenv/core.py", line 126, in which
p = os.sep.join([location] + ['bin/{0}'.format(command)])
TypeError: sequence item 0: expected str instance, NoneType found
This pipenv issues page has the answer you are looking for:
TypeError issue
pipenv install gives me an error on Windows 10 on empty folder:
Traceback (most recent call last):
File "c:\python27\lib\runpy.py", line 174, 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:\Users\ext.thipier1\AppData\Roaming\Python\Scripts\pipenv.exe\__main__.py", line 9, in <module>
File "C:\Users\ext.thipier1\AppData\Roaming\Python\Python27\site-packages\pipenv\vendor\click\core.py", line 722, in __call__
return self.main(*args, **kwargs)
File "C:\Users\ext.thipier1\AppData\Roaming\Python\Python27\site-packages\pipenv\vendor\click\core.py", line 697, in main
rv = self.invoke(ctx)
File "C:\Users\ext.thipier1\AppData\Roaming\Python\Python27\site-packages\pipenv\vendor\click\core.py", line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "C:\Users\ext.thipier1\AppData\Roaming\Python\Python27\site-packages\pipenv\vendor\click\core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "C:\Users\ext.thipier1\AppData\Roaming\Python\Python27\site-packages\pipenv\vendor\click\core.py", line 535, in invoke
return callback(*args, **kwargs)
File "C:\Users\ext.thipier1\AppData\Roaming\Python\Python27\site-packages\pipenv\cli.py", line 366, in install
selective_upgrade=selective_upgrade,
File "C:\Users\ext.thipier1\AppData\Roaming\Python\Python27\site-packages\pipenv\core.py", line 1730, in do_install
skip_requirements=skip_requirements,
File "C:\Users\ext.thipier1\AppData\Roaming\Python\Python27\site-packages\pipenv\core.py", line 604, in ensure_project
three=three, python=python, site_packages=site_packages
File "C:\Users\ext.thipier1\AppData\Roaming\Python\Python27\site-packages\pipenv\core.py", line 537, in ensure_virtualenv
if not project.virtualenv_exists:
File "C:\Users\ext.thipier1\AppData\Roaming\Python\Python27\site-packages\pipenv\project.py", line 207, in virtualenv_exists
if self.pipfile_exists and os.path.exists(self.virtualenv_location):
File "C:\Users\ext.thipier1\AppData\Roaming\Python\Python27\site-packages\pipenv\project.py", line 299, in virtualenv_location
loc = self._get_virtualenv_location(self.virtualenv_name)
File "C:\Users\ext.thipier1\AppData\Roaming\Python\Python27\site-packages\pipenv\project.py", line 279, in virtualenv_name
sanitized, encoded_hash = self._get_virtualenv_hash(self.name)
File "C:\Users\ext.thipier1\AppData\Roaming\Python\Python27\site-packages\pipenv\project.py", line 267, in _get_virtualenv_hash
if not (env[-9] != '-' and
IndexError: string index out of range
It only works if I activate a virtual env before running the command.
I tried on macOS the same procedure and I don't have this problem.
I followed the installation instructions.
What can I do to make it work?