Well this is strange. I'm running Azure Powershell 5.0.1 in my Azure account and attempting to create an App Service Plan to support this tutorial; the step
az appservice plan create --name myAppServicePlan --resource-group myResourceGroup --sku FREE
The error message below references the 'pscloudshell' file (which I've confirmed doesn't exist on my Azure account).
I've tried
- verifying that the file exists (it doesn't)
- a web search on the string 'pscloudshell' and 'FileNotFoundError: [WinError 3] pscloudshell' (but it's pretty sparse) and
a search on Stackoverflow on string 'pscloudshell' to find 'Your search returned no matches.'. I must be the first to experience this?!
The error of which I speak is
PS Azure:\> az appservice plan create --name myAppServicePlan2 --resource-group myResourceGroup2 --sku FREE
Traceback (most recent call last):
File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\lib\site-packages\azure\cli\__main__.py", line 23, in <module>
exit_code = azure.cli.main.main(args)
File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\lib\site-packages\azure\cli\main.py", line 28, in main
os.makedirs(azure_folder)
File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\lib\os.py", line 210, in makedirs
makedirs(head, mode, exist_ok)
File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\lib\os.py", line 220, in makedirs
mkdir(name, mode)
FileNotFoundError: [WinError 3] The system cannot find the path specified: 'C:\\Users\\ContainerAdministrator\\CloudDrive\\.pscloudshell'
az -v give:
azure-cli (2.0.22)
acr (2.0.16)
acs (2.0.21)
advisor (0.1.0)
appservice (0.1.21)
backup (1.0.3)
batch (3.1.7)
batchai (0.1.3)
billing (0.1.6)
cdn (0.0.10)
cloud (2.0.10)
cognitiveservices (0.1.9)
command-modules-nspkg (2.0.1)
configure (2.0.12)
consumption (0.2.0)
container (0.1.14)
core (2.0.22)
cosmosdb (0.1.15)
dla (0.0.15)
dls (0.0.18)
eventgrid (0.1.5)
extension (0.0.6)
feedback (2.0.6)
find (0.2.7)
interactive (0.3.11)
iot (0.1.14)
keyvault (2.0.14)
lab (0.0.13)
monitor (0.0.13)
network (2.0.18)
nspkg (3.0.1)
profile (2.0.15)
rdbms (0.0.9)
redis (0.2.10)
reservations (0.1.0)
resource (2.0.19)
role (2.0.15)
servicefabric (0.0.6)
sql (2.0.16)
storage (2.0.20)
vm (2.0.19)
Python location 'C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\python.exe'
Extensions directory 'C:\Users\ContainerAdministrator\CloudDrive\.pscloudshell\.azure\cliextensions'
Python (Windows) 3.6.1 (v3.6.1:69c0db5, Mar 21 2017, 17:54:52) [MSC v.1900 32 bit (Intel)]
Legal docs and information: aka.ms/AzureCliLegal
I've tried - verifying that the file exists (it doesn't)
I reproduce your error with an old cloud shell, I can't find .pscloudshell in that directory.
Then I delete it from Azure resource group and create a new cloud shell, it works fine:
PS C:\Users\ContainerAdministrator\CloudDrive> pwd
Path
----
C:\Users\ContainerAdministrator\CloudDrive
PS C:\Users\ContainerAdministrator\CloudDrive> ls
Directory: C:\Users\ContainerAdministrator\CloudDrive
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 12/13/2017 4:30 AM .pscloudshell
It seems there are some updates with Azure cloud shell, please delete your original cloud shell and re-create a new one.
You are trying to run Azure CLI command in PowerShell console of Cloud shell, instead You Should run Azure CLI commands in Bash Shell of cloud shell.
Related
To isolate my problem I run a simple two line example program that runs fine when using IDLE or other Python environment. However, whenb I try to convert the program to an executable using pyinstaller it comes with an error. The error is shown at the end of the printout. Any help to solve this problem is appreciated.
Microsoft Windows [Version 10.0.19043.1110]
(c) Microsoft Corporation. All rights reserved.
C:\>
C:\>C:\Users\John\AppData\Local\Programs\Python\Python36\Scripts\pyinstaller example.py
88 INFO: PyInstaller: 4.4
89 INFO: Python: 3.6.5
89 INFO: Platform: Windows-10-10.0.19041-SP0
Traceback (most recent call last):
File "c:\users\John\appdata\local\programs\python\python36\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "c:\users\John\appdata\local\programs\python\python36\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\John\AppData\Local\Programs\Python\Python36\Scripts\pyinstaller.exe\__main__.py", line 7, in <module>
File "c:\users\John\appdata\local\programs\python\python36\lib\site-packages\PyInstaller\__main__.py", line 124, in run
spec_file = run_makespec(**vars(args))
File "c:\users\John\appdata\local\programs\python\python36\lib\site-packages\PyInstaller\__main__.py", line 58, in run_makespec
spec_file = PyInstaller.building.makespec.main(filenames, **opts)
File "c:\users\John\appdata\local\programs\python\python36\lib\site-packages\PyInstaller\building\makespec.py", line 664, in main
with open(specfnm, 'w', encoding='utf-8') as specfile:
PermissionError: [Errno 13] Permission denied: 'C:\\example.spec'
C:\>
Permission denied: 'C:\temp.spec' is your user allowed to write to the root of the C:\ drive?
This begs the question why pyinstaller is trying to write (a temp file?) to C:\ in the first place... is that where your temp.py file (that you want to build into an .exe) is located??
Try moving temp.py to a subfolder of your My Documents, etc. and run the pyinstaller command from there.
PRO-TIP: if pyinstaller's path is listed in your PATH variable, you can call it using only pyinstaller (without the full/explicit path)
I found the problem. By mistake I used the wrong change directory command and because of that I was trying to run the pyinstaller command from the root folder of my C drive, and I don't have permission with a normal command prompt to write files there.
Wrong reference:
C:\>C:\Users\John\AppData\Local\Programs\Python\Python36\Scripts\pyinstaller example.py
Correct reference:
C:\Users\Menachem\AppData\Local\Programs\Python\Python36\Scripts\pyinstaller example.py
Please edit your post so we can see the error clearly for the error try to run by administrator cmd if that didn't help check this
Question
I am trying to download the latest version of one of my existing google appengine projects & I am tired of seeing the errors! I am running the appcfg.py command inside the google sdk python 2.7 dir. Here's what I ran.
python "C:\DEV_Tools\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\appcfg.py" download_app -A <project> -V <version> C:\DEV_Tools\Dump\
Output :
Traceback (most recent call last):
File "C:\DEV_Tools\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\appcfg.py", line 133, in <module>
run_file(__file__, globals())
File "C:\DEV_Tools\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\appcfg.py", line 129, in run_file
execfile(_PATHS.script_file(script_name), globals_)
File "C:\DEV_Tools\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\google\appengine\tools\appcfg.py", line 66, in <module>
from google.appengine.api import appinfo
File "C:\DEV_Tools\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\google\appengine\api\appinfo.py", line 54, in <module>
from google.appengine.api import validation
File "C:\DEV_Tools\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\google\appengine\api\validation.py", line 46, in <module>
from google.appengine._internal.ruamel import yaml
File "C:\DEV_Tools\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\google\appengine\_internal\ruamel\yaml\__init__.py", line 85, in <module>
from google.appengine._internal.ruamel.yaml.main import * # NOQA
File "C:\DEV_Tools\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\google\appengine\_internal\ruamel\yaml\main.py", line 19, in <module>
from google.appengine._internal.ruamel.yaml.loader import BaseLoader, SafeLoader, Loader, RoundTripLoader # NOQA
File "C:\DEV_Tools\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\google\appengine\_internal\ruamel\yaml\loader.py", line 10, in <module>
from google.appengine._internal.ruamel.yaml.constructor import (
File "C:\DEV_Tools\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\google\appengine\_internal\ruamel\yaml\constructor.py", line 21, in <module>
from google.appengine._internal.ruamel.yaml.comments import * # NOQA
File "C:\DEV_Tools\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\google\appengine\_internal\ruamel\yaml\comments.py", line 642, in <module>
class CommentedMap(MutableMapping, ordereddict, CommentedBase):
File "C:\DEV_Tools\Google\Python27\lib\abc.py", line 86, in __new__
cls = super(ABCMeta, mcls).__new__(mcls, name, bases, namespace)
TypeError: Error when calling the metaclass bases
Cannot create a consistent method resolution
order (MRO) for bases CommentedBase, MutableMapping, ordereddict
There could be an issue with the installed files on your system. I have tried to reproduced the issue however I got different kind of error:
Traceback (most recent call last): File "C:\Program Files
(x86)\Google\google_appengine\appcfg.py", line 133, in
run_file(file, globals()) File "C:\Program Files
(x86)\Google\google_appengine\appcfg.py", line 129, in run_file
execfile(_PATHS.script_file(script_name), globals_) NameError: name
'execfile' is not defined
This was due to corrupted installation files. I have completely reinstalled Google App Engine Python SDK and it worked for me. Try the steps below as it might help you as well:
Downloading Source code from GAE:
It only works for App Engine Standard apps
You can confirm that as in you Google Cloud Console where you choose the version of a specific service. The dropdown menu Tools will not give option Source for Flex apps but only for Standard apps
You should have Python version 2.7 installed
You should have latest version of App Engine SDK for Python
Steps:
Go to the Control Panel > Programs & Features and uninstall your Google App Engine SDK.
Go to the path where GAE was installed and delete the google_appengine folder. In your occasion it is C:\DEV_Tools\Google\Cloud SDK\google-cloud-sdk\platform
Install Python 2.7 from here
Install and initialize Google Cloud SDK from Quickstart for Windows
Run Google Cloud SDK as administrator and execute $ gcloud init
Then execute $ gcloud config set project [PROJECT_ID] based on gcloud config set doc.
Execute $ gcloud components install app-engine-python to install GAE Python based on Download the Cloud SDK
Execute $ gcloud components install app-engine-python-extras to install extras.
Execute $ gcloud components update to update the components.
Install GAE SDK for Python as it is mentioned in Download and install the original App Engine SDK for Python
Restart your computer
Run Google Cloud SDK as Administrator
Execute the command $ gcloud info to verify that the correct project and correct user account is setup.
If it is not setup properly the execute $ gcloud init and set up properly to authenticate the SDK.
Execute appcfg.py -A [PROJECT_ID] -V [VERSION_NAME] download_app C:\PATH\TO\SAVE\SOURCE_CODE Make sure that the version is referring to an GAE STANDARD app
It will redirect you to an browser page so you could login with the same account that you set up the SDK for authentication.
You should see:
Authentication successful.
04:37 PM Fetching files...
04:37 PM [1/16] WEB-INF/lib/_ah_compiled_jsps-0000.jar
04:37 PM [2/16] WEB-INF/lib/org.apache.taglibs.taglibs-standard-impl-1.2.5.jar
04:37 PM [3/16] WEB-INF/min-quickstart-web.xml
04:37 PM [4/16] WEB-INF/appengine-generated/app.yaml
04:37 PM [5/16] WEB-INF/lib/org.eclipse.jdt.ecj-3.14.0.jar
04:37 PM [6/16] WEB-INF/web.xml
04:37 PM [7/16] WEB-INF/lib/org.mortbay.jasper.apache-el-8.5.24.2.jar
04:37 PM [8/16] WEB-INF/lib/org.mortbay.jasper.apache-jsp-8.5.24.2.jar
04:37 PM [9/16] source-context.json
04:37 PM [10/16] WEB-INF/quickstart-web.xml
04:38 PM [11/16] WEB-INF/classes/source-context.json
04:38 PM [12/16] WEB-INF/lib/org.apache.taglibs.taglibs-standard-spec-1.2.5.jar
04:38 PM [13/16] WEB-INF/appengine-web.xml
04:38 PM [14/16] WEB-INF/lib/org.eclipse.jetty.apache-jsp-9.4.14.v20181114-nolog
Otherwise if it is GAE Flex you will see this error:
54319 download_app C:\PATH\TO\SAVE\SOURCE_CODE 04:38 PM Host:
appengine.google.com 04:38 PM Fetching file list... Error 400: ---
begin server output --- Major version "[VERSION_NAME]" does not exist.
--- end server output ---
OS Windows 10,
I am using Docker Engine version 18.09.2, the API version is 1.39
The website explaining the steps to run CAT is: https://libraries.io/pypi/medcat
I am building the medcat image locally. Output looks good until the end of the build process:
Step 10/11 : ENTRYPOINT ["python"]
---> Using cache
---> 66b414e2093d
Step 11/11 : CMD ["api.py"]
---> Using cache
---> db2acf6c4649
Successfully built db2acf6c4649
Successfully tagged cat:latest
SECURITY WARNING: You are building a Docker image from Windows against
a non-Windows Docker host. All files and directories added to build
context will have '-rwxr-xr-x' permissions. It is recommended to
double check and reset permissions for sensitive files and
directories.
When I am trying to start the container I just built, I get:
IT IS UMLS
* Serving Flask app "api" (lazy loading)
* Environment: production
WARNING: This is a development server. Do not use it in a
production deployment.
Use a production WSGI server instead.
* Debug mode: on
Traceback (most recent call last):
File "api.py", line 66, in <module>
app.run(debug=True, host='0.0.0.0', port=5000)
File "/usr/local/lib/python3.7/site-packages/flask/app.py", line
944, in run
run_simple(host, port, self, **options)
File "/usr/local/lib/python3.7/site-packages/werkzeug/serving.py",
line 1007, in run_simple
run_with_reloader(inner, extra_files, reloader_interval,
reloader_type)
File "/usr/local/lib/python3.7/site-packages/werkzeug/_reloader.py",
line 332, in run_with_reloader
sys.exit(reloader.restart_with_reloader())
File "/usr/local/lib/python3.7/site-packages/werkzeug/_reloader.py",
line 176, in restart_with_reloader
exit_code = subprocess.call(args, env=new_environ,
close_fds=False)
File "/usr/local/lib/python3.7/subprocess.py", line 323, in call
with Popen(*popenargs, **kwargs) as p:
File "/usr/local/lib/python3.7/subprocess.py", line 775, in __init__
restore_signals, start_new_session)
File "/usr/local/lib/python3.7/subprocess.py", line 1522, in
_execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
OSError: [Errno 8] Exec format error: '/cat/api/api.py'
Does anyone have experience with building on Windows? Does the security warning have anything to do with this?
Update:
I added the permission for linux executable as in the received answer at this post. Then I built the image locally using the following command docker build --network=host -t cat -f Dockerfile.MedMen ., and the end of the building process gives me the same Security Warning.
Then I checked docker run --env-file=./envs/env_medann ubuntu:18.04 env, which gave me:
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
HOSTNAME=3d5fd66fadbe
TYPE=UMLS
DEBUG=False
CNTX_SPAN=6
CNTX_SPAN_SHORT=2
MIN_CUI_COUNT=100
MIN_CUI_COUNT_STRICT=1
MIN_ACC=0.01
MIN_CONCEPT_LENGTH=1
NEG_PROB=0.2
LBL_STYLE=def
SPACY_MODEL=en_core_sci_md
UMLS_MODEL=/cat/models/med_ann_norm.dat
VOCAB_MODEL=/cat/models/med_ann_norm_dict.dat
MKL_NUM_THREAD=1
NUMEXPR_NUM_THREADS=1
OMP_NUM_THREADS=1
HOME=/root
This is because windows & linux has CR-LF & LF difference issue, meanwhile, permission need to be added for linux executable.
For your case, as you have got the source code, I think you have git installed on your windows. Then, you can open Git Bash, change the path to your source code directory, and execute next in it:
find . -type f | xargs dos2unix
chmod -R 777 *
Finally, rebuild it.
Update:
I try your code completely, it seems the issue is in cat/api/api.py, it misses a #!. So, into your sourcecode, edit cat/api/api.py, add next at the beginning of the sourcecode:
#!/usr/bin/env python
Then, rebuild with Dockerfile & run it again, you can see the effect from browser:
My system: Windows 7 professional, 64 bit
Things I have tried:
Reinstalling Anaconda
Made sure I only have one Python version installed (I have 3.6.4)
Added Anaconda to PATH (%PATH;C:\Users\ghost\Anaconda3\python.exe)
system variables
C:\ProgramData\Anaconda3;C:\ProgramData\Anaconda3\Library\mingw-w64\bin;C:\ProgramData\Anaconda3\Library\usr\bin;C:\ProgramData\Anaconda3\Library\bin;C:\ProgramData\Anaconda3\Scripts;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files (x86)\Common Files\Lenovo;C:\ProgramData\Lenovo\ReadyApps;C:\Program Files (x86)\Python;%PATH;C:\Users\ghost\Anaconda3\python.exe;C:\Users\ghost\Anaconda3\Scripts\conda.exe
The Error I receive:
> (base) C:\Users\ghost>anaconda-navigator Traceback (most recent call last): File
> "C:\ProgramData\Anaconda3\Scripts\anaconda-navigator-script.py", line
> 10, in <module>
> sys.exit(main()) File "C:\ProgramData\Anaconda3\lib\site-packages\anaconda_navigator\app\main.p
> y", line 129, in main
> from anaconda_navigator.app.start import start_app File "C:\ProgramData\Anaconda3\lib\site-packages\anaconda_navigator\app\start.
> py", line 27, in <module>
> from anaconda_navigator.utils import misc File "C:\ProgramData\Anaconda3\lib\site-packages\anaconda_navigator\utils\misc
> .py", line 21, in <module>
> import psutil File "C:\Users\ghost\AppData\Roaming\Python\Python36\site-packages\psutil\__in
> it__.py", line 137, in <module>
> from . import _pswindows as _psplatform File "C:\Users\ghost\AppData\Roaming\Python\Python36\site-packages\psutil\_psw
> indows.py", line 16, in <module>
> from . import _psutil_windows as cext ImportError: cannot import name '_psutil_windows'
Let me know if there is any additional information that is needed. Thanks, in advance, for your help!
Go to anaconda prompt, update conda and all packages and install the last version of psutil.
Then, from C:\Users\<youruser>\Anaconda3\pkgs\psutil-5.4.5-py36hfa6e2cd_0\Lib\site-packages, copy the folders psutil and psutil-5.4.5-py3.6.egg-info.
After that, go to C:\Users\<youruser>\AppData\Roaming\Python\Python36\site-packages.
Erase all psutil folders and paste psutil and psutil-5.4.5-py3.6.egg-info.
You may also want to make sure that your PYTHONPATH is not set. You can see all of your relevant environment variables in the output of:
conda info -a
Recently, I have updated Google App Engine from 1.9.17 to 1.9.18 via Google Cloud SDK by using command 'gcloud components update' in Windows 7 64 bit. After that I wasn't able to start any project using the App Engine launcher. Getting this error:
Traceback (most recent call last):
File "C:\Program Files\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\dev_appserver.py", line 83, in <module>
_run_file(__file__, globals())
File "C:\Program Files\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\dev_appserver.py", line 79, in _run_file
execfile(_PATHS.script_file(script_name), globals_)
File "C:\Program Files\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\google\appengine\tools\devappserver2\devappserver2.py", line 36, in <module>
from google.appengine.tools.devappserver2 import dispatcher
File "C:\Program Files\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\google\appengine\tools\devappserver2\dispatcher.py", line 29, in <module>
from google.appengine.tools.devappserver2 import module
File "C:\Program Files\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\google\appengine\tools\devappserver2\module.py", line 71, in <module>
from google.appengine.tools.devappserver2 import vm_runtime_factory
File "C:\Program Files\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\google\appengine\tools\devappserver2\vm_runtime_factory.py", line 25, in <module>
from google.appengine.tools.devappserver2 import vm_runtime_proxy
File "C:\Program Files\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\google\appengine\tools\devappserver2\vm_runtime_proxy.py", line 29, in <module>
from google.appengine.tools.devappserver2 import log_manager
File "C:\Program Files\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\google\appengine\tools\devappserver2\log_manager.py", line 34, in <module>
from google.appengine.tools.docker import containers
File "C:\Program Files\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\google\appengine\tools\docker\containers.py", line 47, in <module>
import docker
ImportError: No module named docker
2015-03-05 19:11:27 (Process exited with code 1)
I even installed the latest Google Cloud SDK, but I'm getting the same error.
I'm able to install the appengine SDK 1.9.18(without using Google Cloud SDK) and able to run the project successfully.
This error is happening only for the App Engine launcher installed via Google Cloud SDK in Windows 7.
This issue is raised in App Engine Issue Tracker: Issue 125. I recommend you to star this issue.
This has happened to me today to reinstall the app engine sdk. I could not run my code in the launcher.
I remember reading that is not used pip app engine, but now I have solved the problem.
In short what I did was:
Install pip the footsteps of https://pip.pypa.io/en/latest/installing.html (this also correctly install the setuptools)
Install docker-py by pip: pip install docker-py and ready, I can now run my code in the launcher
P.S.
Previously I tried to install the docker-py package, downloaded from https://github.com/docker/docker-py, but lacked setuptools, downloaded and installed the package did not work. So use this with pip.
This is currently an issue with the dev_appserver bundled in the Cloud SDK. A fix will be out soon. In the meanwhile, your options are:
1) Use gcloud preview app run to run your app when using the Cloud SDK
2) Install the standalone AppEngine SDK (which you already mentioned in your question)
If installing docker-py doesn't work and the stacktrace shows that the error line is:
from docker import docker
Change this line to:
import docker
Source
Jumping on the answer from #Tzach and adding some info.
The file to modify is containers.py
for me it is located here :
C:\Program Files\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\google\appengine\tools\docker
If you can't modify it because the file is open in an application, it is in fact that the folder is protected. Just copy/paste the file on your desktop and modify it from there. then copy it back in the original folder.