Createprocess error 193 1 не является приложением win32 pycharm

Добрый всем ! Помогите с проблемой, сынуля выразил желание изучить python. Скачал ему курс, сидит изучает. Но возникла трудность, выскакивает ошибка при выполнение. Компьютер 64-разрядная операционная система, процессор x64.Установили Python 3.9.6 и PyCharm Community Edition 2021.1.3 x64Error running ‘a’: Cannot run program “C:Users79166PycharmProjectspythonProjectvenvScriptspython.exe” (in directory “C:Users79166PycharmProjectspythonProject”): CreateProcess error=193, %1 не является приложением Win32

Уведомления

  • Начало
  • » Центр помощи
  • » PyCharm Community Edition 2021.1.3 x64 CreateProcess error=193, %1 не является приложением Win32

#1 Июль 6, 2021 18:43:32

PyCharm Community Edition 2021.1.3 x64 CreateProcess error=193, %1 не является приложением Win32

Добрый всем ! Помогите с проблемой, сынуля выразил желание изучить python. Скачал ему курс, сидит изучает. Но возникла трудность, выскакивает ошибка при выполнение. Компьютер 64-разрядная операционная система, процессор x64.
Установили Python 3.9.6 и PyCharm Community Edition 2021.1.3 x64
Error running ‘a’: Cannot run program “C:Users79166PycharmProjectspythonProjectvenvScriptspython.exe” (in directory “C:Users79166PycharmProjectspythonProject”): CreateProcess error=193, %1 не является приложением Win32

Помогите решить. Спасибо !

Офлайн

  • Пожаловаться

#2 Июль 6, 2021 20:45:35

PyCharm Community Edition 2021.1.3 x64 CreateProcess error=193, %1 не является приложением Win32

Dmitry_32323
проверьте, где у вас лежит на компе python.exe и совпадает ли путь с тем, где PyСharm пытается его найти

если путь неправильный C:Users79166PycharmProjectspythonProjectvenvScriptspython.exe, то в настройках его измените на правильный

Офлайн

  • Пожаловаться

  • Начало
  • » Центр помощи
  • » PyCharm Community Edition 2021.1.3 x64 CreateProcess error=193, %1 не является приложением Win32

The code below fails to start documents. I get error 193 (%1 is not a valid Win32 app). Starting executables work fine.
The files are properly associated, they start the corresponding app when double clicked.
I have searched SO and elsewhere for the error message, createprocess stuff etc. (E.g. Why is CreateProcess failing in Windows Server 2003 64-bit?
I know about quoting the command line.

  • This is a Delphi XE2 (Update 4) Win32 app in a Win7 64bit VMWare VM.

  • The code also fails on the host machine (Win7 64 bit) and in a Virtual PC VM with 32bit XP.

  • The apps that should start in the Win7 VM (Excel 2003 and Crimson Editor) are 32 bit.

  • The failure occurs both when starting from the IDE or when running the test app standalone

  • It used to be Delphi2007 code, the compiled D2007 app where this code comes from works fine everywhere.

What’s wrong with the code?

procedure StartProcess(WorkDir, Filename: string; Arguments : string = '');
var
  StartupInfo  : TStartupInfo;
  ProcessInfo  : TProcessInformation;
  lCmd         : string;
  lOK          : Boolean;
  LastErrorCode: Integer;
begin
  FillChar( StartupInfo, SizeOf( TStartupInfo ), 0 );
  StartupInfo.cb := SizeOf( TStartupInfo );
  StartupInfo.dwFlags := STARTF_USESHOWWINDOW;
  StartupInfo.wShowWindow := sw_Normal;

  FillChar( ProcessInfo, SizeOf( TProcessInformation ), 0 );

  lCmd := '"' +  WorkDir + FileName + '"';     // Quotes are needed https://stackoverflow.com/questions/265650/paths-and-createprocess
  if Arguments <> '' then lCmd := lCmd + ' ' + Arguments;

  lOk := CreateProcess(nil,
                       PChar(lCmd),
                       nil,
                       nil,
                       FALSE,  // TRUE makes no difference
                       0,      // e.g. CREATE_NEW_CONSOLE or NORMAL_PRIORITY_CLASS makes no difference
                       nil,
                       nil,    // PChar(WorkDir) makes no difference
                       StartupInfo,
                       ProcessInfo);

  if lOk then
  begin
    try
      WaitForSingleObject(ProcessInfo.hProcess, INFINITE);
    finally
      CloseHandle( ProcessInfo.hThread );
      CloseHandle( ProcessInfo.hProcess );
    end;
  end
  else
  begin
    LastErrorCode := GetLastError;
    ShowMessage(IntToStr(LastErrorCode) + ': ' + SysErrorMessage(LastErrorCode));
  end;
end;

procedure TFrmStartProcess.Button1Click(Sender: TObject);
begin
   StartProcess('c:program files (x86)axe3','axe.exe');    // Works
end;

procedure TFrmStartProcess.Button2Click(Sender: TObject);
begin
   StartProcess('d:','klad.xls');                            // Fails
end;

procedure TFrmStartProcess.Button3Click(Sender: TObject);
begin
   StartProcess('d:','smimime.txt');                         // Fails
end;

The code below fails to start documents. I get error 193 (%1 is not a valid Win32 app). Starting executables work fine.
The files are properly associated, they start the corresponding app when double clicked.
I have searched SO and elsewhere for the error message, createprocess stuff etc. (E.g. Why is CreateProcess failing in Windows Server 2003 64-bit?
I know about quoting the command line.

  • This is a Delphi XE2 (Update 4) Win32 app in a Win7 64bit VMWare VM.

  • The code also fails on the host machine (Win7 64 bit) and in a Virtual PC VM with 32bit XP.

  • The apps that should start in the Win7 VM (Excel 2003 and Crimson Editor) are 32 bit.

  • The failure occurs both when starting from the IDE or when running the test app standalone

  • It used to be Delphi2007 code, the compiled D2007 app where this code comes from works fine everywhere.

What’s wrong with the code?

procedure StartProcess(WorkDir, Filename: string; Arguments : string = '');
var
  StartupInfo  : TStartupInfo;
  ProcessInfo  : TProcessInformation;
  lCmd         : string;
  lOK          : Boolean;
  LastErrorCode: Integer;
begin
  FillChar( StartupInfo, SizeOf( TStartupInfo ), 0 );
  StartupInfo.cb := SizeOf( TStartupInfo );
  StartupInfo.dwFlags := STARTF_USESHOWWINDOW;
  StartupInfo.wShowWindow := sw_Normal;

  FillChar( ProcessInfo, SizeOf( TProcessInformation ), 0 );

  lCmd := '"' +  WorkDir + FileName + '"';     // Quotes are needed https://stackoverflow.com/questions/265650/paths-and-createprocess
  if Arguments <> '' then lCmd := lCmd + ' ' + Arguments;

  lOk := CreateProcess(nil,
                       PChar(lCmd),
                       nil,
                       nil,
                       FALSE,  // TRUE makes no difference
                       0,      // e.g. CREATE_NEW_CONSOLE or NORMAL_PRIORITY_CLASS makes no difference
                       nil,
                       nil,    // PChar(WorkDir) makes no difference
                       StartupInfo,
                       ProcessInfo);

  if lOk then
  begin
    try
      WaitForSingleObject(ProcessInfo.hProcess, INFINITE);
    finally
      CloseHandle( ProcessInfo.hThread );
      CloseHandle( ProcessInfo.hProcess );
    end;
  end
  else
  begin
    LastErrorCode := GetLastError;
    ShowMessage(IntToStr(LastErrorCode) + ': ' + SysErrorMessage(LastErrorCode));
  end;
end;

procedure TFrmStartProcess.Button1Click(Sender: TObject);
begin
   StartProcess('c:program files (x86)axe3','axe.exe');    // Works
end;

procedure TFrmStartProcess.Button2Click(Sender: TObject);
begin
   StartProcess('d:','klad.xls');                            // Fails
end;

procedure TFrmStartProcess.Button3Click(Sender: TObject);
begin
   StartProcess('d:','smimime.txt');                         // Fails
end;

I just try to start Electron app on Windows with Electron Quick Start .

How to fix this error when running Electron on PyCharm?

runnerw.exe: CreateProcess failed with error 193: %1 is not a valid Win32 application.

PS: I am running on Windows 10 x64

My Electron Configuration
My Electron Configuration
My Error
My Error

asked Oct 10, 2018 at 1:13

flyingduck92's user avatar

flyingduck92flyingduck92

1,3802 gold badges19 silver badges37 bronze badges

Try to use .binelectron.cmd instead of .binelectron in Node interpreter configuration

Hope this help.

answered Oct 10, 2018 at 7:40

Hai Pham's user avatar

1

I had the same problem with Git in Intellij IDEA, when I change a path in settings on C:Program FilesGitcmdgit.exe — it works now! Thanks

answered Aug 7, 2020 at 12:47

Mary's user avatar

I also had this problem when installing PyCharm.
When click on «Configure», I had set the path to «C:Program FilesGit», that is where I installed Git in my computer.
It turns out that the executable file is in «C:Program FilesGitcmdgit.exe», so I made the explicit reference and now it works

answered Dec 31, 2018 at 12:27

xiaxio's user avatar

xiaxioxiaxio

6261 gold badge10 silver badges15 bronze badges

Oserror winerror is not a valid win applicationThe error code that reads oserror: [winerror 193] %1 is not a valid win32 application occurs when using Python or a Python software package. Meanwhile, the error code is a cryptic message, and it’s a tough one to decipher. Well, you are in luck because we have identified situations that cause the error.

Keep on reading, to learn how to fix each issue.

Contents

  • Why Oserror: [Winerror 193] %1 Is Not a Valid Win32 Application is Happening?
    • – Incompatible Versions of Python and Tensorflow
    • – Python Environments Conflicts
    • – You Are Calling a 32bit Dll File Into a 64bit Process
    • – You Are Running Semgrep Directly on Windows
    • – You Have Old Data From a Previous Installation of Pycharm
    • – You Are Using Liblsl-python With a Rogue Liblsl
    • – You Are Rendering a Latex Expression on Inkscape V1.1
    • – You Are Calling the Python Subprocess Module on a Python File
  • How To Fix Oserror Not Valid win32 Application?
    • – Don’t Use 64bit Python With 32bit Tensorflow
    • – Ensure You Have a Clean Python Environment
    • – Do Not Load a 32bit Dll Into a 64bit Process
    • – Use Semgrep via Windows Subsystem for Linux
    • – Always Remove Data From Previous Pycharm Installations
    • – Add the Pylsl_lib to Your Environment Variable
    • – Replace Inkscape Extension Folder
    • – Call the Python Subprocess Module on a Python Executable
  • Conclusion

The OSError can occur because of any reasons listed below:

  • Incompatible versions of Python and TensorFlow
  • Python environments conflicts
  • You are calling a 32bit DLL file into a 64bit process
  • You are running Semgrep directly on Windows
  • You have old data from a previous installation of Pycharm
  • You are using liblsl-Python with a rogue liblsl
  • You are rendering a LaTeX expression on Inkscape V1.1
  • You are calling the Python subprocess module on a Python file

– Incompatible Versions of Python and Tensorflow

You’ll have the OSError when you’ve installed different versions of Python and TensorFlow. When we say “versions”, we mean architecture versions of the software themselves. Therefore, an error will occur if you try to use a 32bit version of TensorFlow with a 64bit Python. That’s because both architecture versions are not compatible.

This is not only applicable to Python and TensorFlow. It applies to most software, and it’s the main reason you can’t install a 64bit Windows on a 32bit machine.

– Python Environments Conflicts

Python environment conflicts occur when you have different Python installed on your system. As a result, when you import a package like Numpy you can get an error message. In the error message, part of it will read “self.handle = _dlopen(self.name, mode) oserror: [winerror 193] %1 is not a valid win32 application”. If you are running Django, you can also run into the same problem.

– You Are Calling a 32bit Dll File Into a 64bit Process

When you call a 32bit DLL file into a 64bit process, you’ll set off a chain reaction that’ll cause an OSError. One of the situations this occurs is when you are working with Pandas on a 64bit machine. If the Pandas version is 32bit, an error occurs when you attempt to import it to a 64bit Python environment. This same situation is more prominent when you use Python in Visual Studio 2019.

The reason is that by default, Visual Studio 2019 provides a 32bit CMD that allows you to install modules. Therefore, when you use the CMD to download Pandas, it’ll download a 32bit version of Pandas. So, you’ll have a problem if you are on a 64bit system. Any attempt to use the Pandas will cause not a valid win32 application Visual Studio 2019 error.

Another variation of the error is the winerror 193 python dll error.

– You Are Running Semgrep Directly on Windows

Semgrep works fine on a Linux system or via Docker. However, on Windows, an OSError occurs if you run Semgrep directly on the system.

– You Have Old Data From a Previous Installation of Pycharm

An old data from a PyCharm installation can cause the OSError. That’s because when you run the newer PyCharm installation, it could read the old data. Therefore, you’ll get an error when you import a library into PyCharm. For example, the oserror: [winerror 193] %1 is not a valid win32 application pycharm error.

Importing a library into Pycharm is not the only cause of the OSError when you have old data. What’s more, a misconfiguration in pipenv when using Pycharm can cause the OSError. An example is the createprocess error=193, %1 is not a valid win32 application pipenv error.

– You Are Using Liblsl-python With a Rogue Liblsl

If your system has a C++ lsl library from uninstalled software, it can cause an OSError. An error occurs when you try to import StreamInlet when using liblsl-python.

– You Are Rendering a Latex Expression on Inkscape V1.1

In Inkscape V1.1, you can get the OSError when you run a LaTeX expression in the textbox. However, that is not the case with older versions of Inkscape. What’s more, you can have a newer version of Inkscape, so you might not get the error. So, if you’d like to reproduce the error in Inkscape V1.1, take the following are the steps:

  1. Launch Inkscape
  2. Navigate to Extensions → Rendering → mathematics → pdfLatex
  3. Type a mathematical term in the textbox

– You Are Calling the Python Subprocess Module on a Python File

If you call the Python subprocess module directly on a Python file, you’ll get the OSError. For example, the following Python code will result in an error:

import subprocess

subprocess.call([‘hello-world.py’, ‘filename.htm’])

A quick look at the code shows that we have called the subprocess.call() function on the hello-world.py file. So, the execution of this code will cause the OSError.

How To Fix Oserror Not Valid win32 Application?

You can fix the OSError by performing steps that’ll prevent the error in the first place. Such steps can include using the right combination of libraries or having a clean installation of the said libraries. When you use a module in Python, make sure you know how to call it. Let’s discuss the solutions in more detail.

– Don’t Use 64bit Python With 32bit Tensorflow

When you have a 64bit system, you should install a 64bit version of TensorFlow. This prevents the OSError from happening in the first place. However, you might install a 32bit version of TensorFlow without knowing. To prevent such a mistake, download TensorFlow from the official website.

Note that using 64bit Python with 32bit TensorFlow is called architecture mismatch. So, ensure both your Python and TensorFlow suits your system architecture. This means 64bit Python with 64bit TensorFlow and 32bit Python with 32bit TensorFlow.

– Ensure You Have a Clean Python Environment

On your system, ensure you have a single Python installation. When you do this, you reduce the chances of a conflict with another Python version. However, in the case where you have multiple Python versions on your system, uninstall all of them and the libraries associated with each Python version.

Afterward, perform a clean installation of a Python version and its associated libraries. We recommend a clean installation when using the nltk library. You should do this when you run into nltk oserror: (winerror 193) %1 is not a valid win32 application error.

– Do Not Load a 32bit Dll Into a 64bit Process

When you load a 64bit DLL Into a 64bit Process, you’ll stop the OSError from happening. But if you are using Visual Studio for Python, you might load a 32bit DLL Into a 64bit process. The fix is to ensure that Visual Studio downloads Python modules using the right CMD for your system. You can set the correct CMD version on Visual Studio by doing the following steps:

  1. Navigate to Tools
  2. Select Options
  3. Select Terminal
  4. Under Profiles, choose the right CMD version for your system
  5. If you are on a 32bit system, set the location of CMD to the 32bit version
  6. If you are on a 64bit system, set the location of CMD to the 64bit version

– Use Semgrep via Windows Subsystem for Linux

When you run Semgrep on Windows Subsystem for Linux (wsl or wsl2), you’ll prevent the OSError. Therefore, If you have a Windows system, do the following to get Semgrep working for you:

  1. Install WSL 2 Ubuntu Virtual Machine from the official WSL page
  2. Modify your .bashrc to take out the standard Windows Python.
  3. Add the following location: “/home/local/.local/bin”. This location is for Python3 CLI application installation
  4. Install Python 3.8 and PIP on Ubuntu using apt
  5. Install Semgrep Via PIP

When you perform these steps, Semgrep should work as expected and you’ll have no OSError.

– Always Remove Data From Previous Pycharm Installations

Anytime you uninstall Pycharm, remove residual and left-over files. If you are on Windows, check the AppData folder and remove any old folder related to Pycharm. You can do a manual removal of the folder, or via a disk clean-up tool.

– Add the Pylsl_lib to Your Environment Variable

If you are using liblsl-Python, you should add the PYLSL_LIB as a new environment variable. Afterward, set it to the full path. When you do this, you’ll prevent the OSError. This also ensures that PYLSL tries to load the right library.

– Replace Inkscape Extension Folder

When you replace the Inkscape extensions folder, OSError will not occur. This is the case when you are working with LaTeX expression in Inkscape V1.1. So, you can get a replacement from the GitLab branch (1.1.X).

– Call the Python Subprocess Module on a Python Executable

The correct usage of the Python Subprocess is to call it as an executable. Earlier in this article, we gave the following example which caused the OSError:

import subprocess

subprocess.call([‘hello-world.py’, ‘filename.htm’])

The following is the correct way to use the Subprocess module:

import subprocessual

subprocess.call([‘python.exe’, ‘hello-world.py’, ‘filename.htm’])

Conclusion

This article explained situations that cause the OSError when running Python applications and how to fix each situation. The following is the summary of what we discussed out the OSError:

  • An architecture mismatch can cause an OSError.
  • Calling the Python subprocess module on a python file can cause an OSError.
  • Loading a 32bit DLL into a 64bit process can cause the OSError.
  • Removing old data from previous Python and Pycharm installations prevents the OSError.
  • In Visual Studio, download modules using the right CMD for your architecture.

How to fix oserror is not a valid win applicationAt this stage, we are confident you can fix the OSError when using Python and its libraries.

  • Author
  • Recent Posts

Position is Everything

Position Is Everything: Your Go-To Resource for Learn & Build: CSS,JavaScript,HTML,PHP,C++ and MYSQL.

Position is Everything

Содержание

  1. OSError: [WinError 193] %1 Is Not a Valid Win32 Application
  2. What Is the OSError: [WinError 193] %1 is not a valid Win32 application
  3. Why Does the OSError: [WinError 193] %1 is not a valid Win32 application Occurs
  4. Different Reasons and Solutions of OSError: [WinError 193] %1 is not a valid Win32 application
  5. Python subprocess Module on a Python File
  6. Incompatible Versions of Python and TensorFlow
  7. Python Environments Dispute
  8. Calling a 32-Bit DLL File Into a 64-Bit Process
  9. Running Semgrep Directly
  10. Due to Old Data
  11. OSError: [WinError 193] %1 is not a valid Win32 application #27693
  12. Comments

OSError: [WinError 193] %1 Is Not a Valid Win32 Application

You receive an error when attempting to run an executable ( .exe ) file. This error occurs when an executable file is not a valid Win32 application.

It may be caused by a mismatch between the local computer’s processor architecture and the executable file’s architecture. When you double-click the .exe file, you may receive the error message:

What Is the OSError: [WinError 193] %1 is not a valid Win32 application

One of the biggest frustrations when developing with Python is dealing with Python errors. There are a lot of different errors that can occur when writing Python code, but one of the most confusing errors to deal with is the OSError: [WinError 193] %1 is not a valid Win32 application .

This error occurs when you try to run a Python script or program that has not been installed correctly on your computer.

You will get the error whether you run a Python script from the command line or double-clicking a file associated with Python. This error is also different from a syntax error or other error that tells you that there is an error in your Python code.

This error is usually caused by an incorrect path to your computer’s Python executable or .pyd file.

Why Does the OSError: [WinError 193] %1 is not a valid Win32 application Occurs

Whenever you open a new window in your browser, an error message could pop up saying that the application you are trying to open is not a valid Win32 application. This error occurs in the Internet Explorer browser, meaning that the file you are trying to open is not a valid application.

This can be a crucial security hole, as any file can be marked as a valid Win32 application by simply modifying its file extension. It’s very easy to do this with common file editing software.

So, if you are not careful, you will open a file you have no business with. One of the most common reasons this error happens is because you are trying to open a file that is not an application.

For example, if you have some HTML file with a .html extension, it will not work. You need to change the file extension to .exe to open the file in your browser.

Another reason might be that the file is corrupt or has some other issues. In this case, you need to download the file again from the source and try opening it on your computer.

Different Reasons and Solutions of OSError: [WinError 193] %1 is not a valid Win32 application

Below are the reasons and solutions for the error.

Python subprocess Module on a Python File

You’re calling the Python subprocess module on a Python file. The Python subprocess module only accepts command line arguments.

To run Python code, you will need to create a Win32 executable that can be run via the subprocess module or use the subprocess module in Python code by running it as a script.

There is an example of an OSError . This code will show the OSError , and then we will provide the solution for this error.

In this scenario, when we call a Python file hello.py within the Python interpreter with subprocess , it will show an OSError .

This will show that hello.py is not executable. For execution, the executable must be clear like:

If you want to make python.exe visible in the search path, then you should pass the entire path from the executable that will run the python.exe address.

Incompatible Versions of Python and TensorFlow

Incompatible versions of Python and TensorFlow are a reason for OSError . Due to incompatible versions of Python and TensorFlow, this application has stopped functioning.

This can occur if a different version of Python is installed on your computer than the version of Python that TensorFlow was built with. You can fix this by reinstalling TensorFlow and updating your PATH variable to point to the correct Python installation.

Sometimes you may have problems with running Python scripts with TensorFlow on Windows. If you see the OSError: [WinError 193] %1 is not a valid Win32 application ; this happens because TensorFlow is a 64-bit application, while Python is 32-bit, and you are trying to run a 32-bit version of Python with a 64-bit TensorFlow.

To fix this, you need to install the 32-bit version of TensorFlow.

Python Environments Dispute

Updating your Python environments is a bit of a hassle because two different versions of Python environments are available: 32-bit and 64-bit. And many people fail to update their Python environments.

This failure can cause your Python environments to malfunction and crash your computer. If you use Python environments on your computer, you need to update it as soon as possible.

If you don’t use Python environments, you should check out an article on the benefits of Python environments.

A clean Python environment is the best way to run the Python scripts. If you are getting a Windows error OSError: [WinError 193] %1 is not a valid Win32 application while running a Python script, the problem is most likely with your Python installation.

So you need to ensure that you have a clean Python environment.

When you install Python, it adds a shortcut to its folder on your desktop and your Start menu. You also install pip , which lets you install third-party Python modules.

However, Python keeps a record of all the modules you have installed. This can make it difficult to update your Python installation because you have to remove those modules before you can update Python.

So, what you need to do is to delete the folder that contains the Python installation files. For many people, this folder is C:Python27 .

Calling a 32-Bit DLL File Into a 64-Bit Process

You are calling a 32-bit DLL file into a 64-bit process. This error usually occurs when you have a 32-bit and 64-bit version of a DLL.

For example, a feature you are trying to use is found in a 32-bit DLL and a 64-bit DLL. The 64-bit DLL overrides the functions of the 32-bit DLL.

You can see this error when running a 64-bit process using a 32-bit DLL.

One of the most common errors when running a 32-bit application on a 64-bit operating system is the error message: OSError: [WinError 193] %1 is not a valid Win32 application . The error message has a %1 in place of the application you are trying to run.

The error pops up when you try to run the application, which is not a valid Win32 application. If the application is a 32-bit application, you need to install the 32-bit version of the application.

If the application is a 64-bit application, you need to install the 64-bit version of the application.

Running Semgrep Directly

It can be quite annoying when you try to launch Semgrep directly on Windows. It can cause an OSError .

So you should avoid running semgrep directly on Windows.

You go to your Start menu, and there is no Semgrep.exe application to be seen. It’s not there because Semgrep is not a typical Windows application but a console application.

If you want to use Semgrep directly on Windows, you will have to launch it through a cmd window. The easiest way is to hold down your Windows key and press the R key.

This will open the run prompt. At this point, you should type cmd and press Enter .

You now have a command prompt. You can now go to the directory where Semgrep is installed and type in semgrep .

Due to Old Data

Old data from the last installation of PyCharm may cause the OSError . So to avoid this error, you should follow this solution.

You have old data from a previous installation of PyCharm in the following directory: C:Users .ipython profile_defaulthistory .

This directory contains files that a previous version of PyCharm has created and can contain old files (for example, a file with a name generated by a previous version of PyCharm).

To prevent this directory from being created in the future, select the option Do not create a .ipython directory in the profile settings. Note that this will not affect the history of files that already exist in the directory.

Zeeshan is a detail oriented software engineer that helps companies and individuals make their lives and easier with software solutions.

Источник

OSError: [WinError 193] %1 is not a valid Win32 application #27693

I am trying to run the following code with anaconda 4.7.12

Unfortunately I’m getting the following error

The text was updated successfully, but these errors were encountered:

lt is likely that your environment is messed up. As you can see from the traceback, there are two python environments involved here:

Please make sure your PATH is clean and you can actually remove one of them first.

I’d removed all the numpy libraries and installed everything from the beginning and that solution worked for me.

Still not working!

I am having this kind of problem in django!
Can anybody could solve this or have similar kind of problem.
Error:
self._handle = _dlopen(self._name, mode)
OSError: [WinError 193] %1 is not a valid Win32 application

@sthabinod Well, it means that at least one dependency in the DLL load chain is not a valid one. You may get some better idea if you debug with Process Monitor or the Debugging Tools for Windows.

I uninstall python and anaconda and reinstall it again but same error.
uncell(0, ‘E:/spider 1.py’)
Traceback (most recent call last):

File «E:spider 1.py», line 8, in
import pandas as pd

File «C:UsersP.C.Sanaconda3libsite-packagespandas_init_.py», line 11, in
import(dependency)

File «C:UsersP.C.SAppDataRoamingPythonPython38site-packagesnumpy_init_.py», line 138, in
from . import _distributor_init

File «C:UsersP.C.SAppDataRoamingPythonPython38site-packagesnumpy_distributor_init.py», line 26, in
WinDLL(os.path.abspath(filename))

File «C:UsersP.C.Sanaconda3libctypes_init_.py», line 373, in init
self._handle = _dlopen(self._name, mode)

OSError: [WinError 193] %1 is not a valid Win32 application

@Mubashir-alam You have multiple Python installations.
C:UsersP.C.Sanaconda3
C:UsersP.C.SAppDataRoamingPythonPython38
And I guess the second one is 32-bit, not 64-bit. That’s why it throws this error.

Just type «print(self._name)» in the place of error — e.g. file «C:UsersnoumaAnaconda3libctypes__init__.py», line 356″, just before line 356.
Eg.g. in my case if take «C:gnuwin32binmagic1.dll» instead of «magic1.dll».
I fix it to temporary remove «C:gnuwin32bin» from PATH.

OSError Traceback (most recent call last)
in
—-> 1 import sklearn

c:userschlbulappdatalocalprogramspythonpython37libsite-packagessklearn_init_.py in
80 from . import _distributor_init # noqa: F401
81 from . import __check_build # noqa: F401
—> 82 from .base import clone
83 from .utils._show_versions import show_versions
84

c:userschlbulappdatalocalprogramspythonpython37libsite-packagessklearnbase.py in
11 import re
12
—> 13 import numpy as np
14
15 from . import version

AppDataRoamingPythonPython37site-packagesnumpy_init_.py in
140 from . import _distributor_init
141
—> 142 from . import core
143 from .core import *
144 from . import compat

AppDataRoamingPythonPython37site-packagesnumpycore_init_.py in
21 # NOTE: would it change behavior to load ALL
22 # DLLs at this path vs. the name restriction?
—> 23 WinDLL(os.path.abspath(filename))
24 DLL_filenames.append(filename)
25 if len(DLL_filenames) > 1:

c:userschlbulappdatalocalprogramspythonpython37libctypes_init_.py in init(self, name, mode, handle, use_errno, use_last_error)
362
363 if handle is None:
—> 364 self._handle = _dlopen(self._name, mode)
365 else:
366 self._handle = handle

OSError: [WinError 193] %1 is not a valid Win32 application

what should I do?

Just type «print(self.name)» in the place of error — e.g. file «C:UsersnoumaAnaconda3libctypes_init.py», line 356″, just before line 356.
Eg.g. in my case if take «C:gnuwin32binmagic1.dll» instead of «magic1.dll».
I fix it to temporary remove «C:gnuwin32bin» from PATH.

Thanks A Lot, That actually solved my problem.

@sthabinod Hello, may I know whether you have fixed the issue? I got the same problem, thanks.

@sthabinod Hello, may I know whether you have fixed the issue? I got the same problem, thanks.

Hi, I can not completely recall what have i done to fix it, but probably it has something to do with the comment that i replied to

@sthabinod Thanks for your kind reply. I fixed the issue related to the package version by reinstalling it.

Hello everyone struggling with python, I had similar problem, may be this experience will help someone
imported sklearn, but program logs said:

File «C:UsersАAppDataRoamingPythonPython38site-packagesscipy_distributor_init.py», line 61, in
WinDLL(os.path.abspath(filename))
File «C:UsersАAppDataLocalProgramsPythonPython38libctypes_init_.py», line 369, in init
self._handle = _dlopen(self._name, mode)
OSError: [WinError 193] %1 не является приложением Win32

with sklearn everything was ok, but it used preinstalled scipy, then I decided to reinstall in by
pip uninstall scipy -> pip install scipy
And solved this problem, so the problem also might be in preinstalled packages

C:UsersuserDesktopstorefront>pipenv install mysqlclient
Installing mysqlclient.
Traceback (most recent call last):
File «C:UsersuserAppDataLocalProgramsPythonPython310librunpy.py», line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File «C:UsersuserAppDataLocalProgramsPythonPython310librunpy.py», line 86, in run_code
exec(code, run_globals)
File «C:UsersuserAppDataLocalProgramsPythonPython310Scriptspipenv.exe_main
.py», line 7, in
File «C:UsersuserAppDataLocalProgramsPythonPython310libsite-packagespipenvvendorclickcore.py», line 1128, in call
return self.main(*args, **kwargs)
File «C:UsersuserAppDataLocalProgramsPythonPython310libsite-packagespipenvclioptions.py», line 56, in main
return super().main(*args, **kwargs, windows_expand_args=False)
File «C:UsersuserAppDataLocalProgramsPythonPython310libsite-packagespipenvvendorclickcore.py», line 1053, in main
rv = self.invoke(ctx)
File «C:UsersuserAppDataLocalProgramsPythonPython310libsite-packagespipenvvendorclickcore.py», line 1659, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File «C:UsersuserAppDataLocalProgramsPythonPython310libsite-packagespipenvvendorclickcore.py», line 1395, in invoke
return ctx.invoke(self.callback, **ctx.params)
File «C:UsersuserAppDataLocalProgramsPythonPython310libsite-packagespipenvvendorclickcore.py», line 754, in invoke
return __callback(*args, **kwargs)
File «C:UsersuserAppDataLocalProgramsPythonPython310libsite-packagespipenvvendorclickdecorators.py», line 84, in new_func
return ctx.invoke(f, obj, *args, **kwargs)
File «C:UsersuserAppDataLocalProgramsPythonPython310libsite-packagespipenvvendorclickcore.py», line 754, in invoke
return __callback(*args, **kwargs)
File «C:UsersuserAppDataLocalProgramsPythonPython310libsite-packagespipenvclicommand.py», line 222, in install
do_install(
File «C:UsersuserAppDataLocalProgramsPythonPython310libsite-packagespipenvcore.py», line 2161, in do_install
c = pip_install(
File «C:UsersuserAppDataLocalProgramsPythonPython310libsite-packagespipenvcore.py», line 1550, in pip_install
pip_args = get_pip_args(
File «C:UsersuserAppDataLocalProgramsPythonPython310libsite-packagespipenvcore.py», line 1388, in get_pip_args
if project.environment.pip_version >= parse_version(«19.0»):
File «C:UsersuserAppDataLocalProgramsPythonPython310libsite-packagespipenvproject.py», line 319, in environment
self._environment = self.get_environment(allow_global=allow_global)
File «C:UsersuserAppDataLocalProgramsPythonPython310libsite-packagespipenvproject.py», line 299, in get_environment
environment = Environment(
File «C:UsersuserAppDataLocalProgramsPythonPython310libsite-packagespipenvenvironment.py», line 70, in init
self._base_paths = self.get_paths()
File «C:UsersuserAppDataLocalProgramsPythonPython310libsite-packagespipenvenvironment.py», line 394, in get_paths
c = subprocess_run(command)
File «C:UsersuserAppDataLocalProgramsPythonPython310libsite-packagespipenvutilsprocesses.py», line 75, in subprocess_run
return subprocess.run(
File «C:UsersuserAppDataLocalProgramsPythonPython310libsubprocess.py», line 501, in run
with Popen(*popenargs, **kwargs) as process:
File «C:UsersuserAppDataLocalProgramsPythonPython310libsubprocess.py», line 966, in init
self._execute_child(args, executable, preexec_fn, close_fds,
File «C:UsersuserAppDataLocalProgramsPythonPython310libsubprocess.py», line 1435, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
OSError: [WinError 193] %1 is not a valid Win32 application

I only have 3 files in Python310 folder in c drive ,they are as follows
_tkinter.lib
python3.lib
python310.lib

I dont get which file is conflicting ,when i call a subprocess.
I get the below error :

Exception in Tkinter callback
Traceback (most recent call last):
File «C:UsersSarveshAppDataLocalProgramsPythonPython310libtkinter_init_.py», line 1921, in call
return self.func(*args)
File «D:MSC ITPart 2ProjectMy projectlogin.py», line 42, in login_function
else :subprocess.call(‘two_people.jpg’)
File «C:UsersSarveshAppDataLocalProgramsPythonPython310libsubprocess.py», line 345, in call
with Popen(*popenargs, **kwargs) as p:
File «C:UsersSarveshAppDataLocalProgramsPythonPython310libsubprocess.py», line 966, in init
self._execute_child(args, executable, preexec_fn, close_fds,
File «C:UsersSarveshAppDataLocalProgramsPythonPython310libsubprocess.py», line 1435, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
OSError: [WinError 193] %1 is not a valid Win32 application

I had the same problem with matplotlib, but as it turned out, numpy was causing the issue. I fixed it with «pip install —upgrade numpy»

Источник

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and
privacy statement. We’ll occasionally send you account related emails.

Already on GitHub?
Sign in
to your account


Closed

BobbeYo1983 opened this issue

Oct 3, 2022

· 10 comments

Assignees

@dturner

Labels

bug

Something isn’t working

p0

Top priority

Comments

@BobbeYo1983

Is there an existing issue for this?

  • I have searched the existing issues

Is there a StackOverflow question about this issue?

  • I have searched StackOverflow

What happened?

Previously, the project was going. Recently updated and not going.

Relevant logcat output

CreateProcess error=193, %1 не является приложением Win32

A problem occurred starting process 'command 'tools/setup.sh''
> Could not start 'tools/setup.sh'

* Try:
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Exception is:
org.gradle.process.internal.ExecException: A problem occurred starting process 'command 'tools/setup.sh''
	at org.gradle.process.internal.DefaultExecHandle.execExceptionFor(DefaultExecHandle.java:241)
	at org.gradle.process.internal.DefaultExecHandle.setEndStateInfo(DefaultExecHandle.java:218)
	at org.gradle.process.internal.DefaultExecHandle.failed(DefaultExecHandle.java:370)
	at org.gradle.process.internal.ExecHandleRunner.run(ExecHandleRunner.java:87)
	at org.gradle.internal.operations.CurrentBuildOperationPreservingRunnable.run(CurrentBuildOperationPreservingRunnable.java:42)
	at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
	at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
Caused by: net.rubygrapefruit.platform.NativeException: Could not start 'tools/setup.sh'
	at net.rubygrapefruit.platform.internal.DefaultProcessLauncher.start(DefaultProcessLauncher.java:27)
	at net.rubygrapefruit.platform.internal.WindowsProcessLauncher.start(WindowsProcessLauncher.java:22)
	at net.rubygrapefruit.platform.internal.WrapperProcessLauncher.start(WrapperProcessLauncher.java:36)
	at org.gradle.process.internal.ExecHandleRunner.startProcess(ExecHandleRunner.java:98)
	at org.gradle.process.internal.ExecHandleRunner.run(ExecHandleRunner.java:71)
	... 3 more
Caused by: java.io.IOException: Cannot run program "tools/setup.sh" (in directory "C:DATADevelopASexamplenowinandroid"): CreateProcess error=193, %1 �� �������� ����������� Win32
	at net.rubygrapefruit.platform.internal.DefaultProcessLauncher.start(DefaultProcessLauncher.java:25)
	... 7 more
Caused by: java.io.IOException: CreateProcess error=193, %1 �� �������� ����������� Win32
	... 8 more

Code of Conduct

  • I agree to follow this project’s Code of Conduct

@keyboardsurfer

This looks like the shell you’re using is incompatible with the setup bash script. Please try again with a bash-compatible shell.

@BobbeYo1983

To be honest, I don’t understand what it is about and what a bash-compatible shell is. I superficially read that this is probably related to Linux. But earlier I collected on Windows and now I’m going to Windows.

@Vivecstel

Having the same issue on windows.

@cengiztoru

Same issue in «Android Studio Flamingo | 2022.2.1 Canary 2» on windows

@alexvanyo

I think we recently added running tools/setup.sh automatically as part of syncing, which shouldn’t be necessary for just cloning and running the project.

We should probably run it instead inside a Gradle task that can be invoked manually if desired?

@LeitHunt

CreateProcess error=193, %1 is not a valid Win32 application

A problem occurred starting process ‘command ‘tools/setup.sh»

Could not start ‘tools/setup.sh’

Any solution ?

@alexvanyo

@BobbeYo1983

@OleksandrKucherenko

lelelongwang

referenced
this issue

Oct 10, 2022

@wojtek-kalicinski

Also adds automatic git hooks installation

Change-Id: I18debbee43af27db7b95a4202f824fa87e186713

@dturner

Thanks for reporting this. It should have been fixed in #335

Labels

bug

Something isn’t working

p0

Top priority

Привет! Я начал изучать ruGPT2 от сбера, установил сначала у меня выскакивала ошибка «Нету модуля typing_extensions» хотя он у меня был. Не долго думая я решил его переустановить и после переустановки стала выскакивать такая вот ошибка:

Traceback (most recent call last):
  File "D:Web-Developerpythonindex.py", line 1, in <module>
    from transformers import GPT2LMHeadModel, GPT2Tokenizer
  File "C:UsersUserAppDataLocalProgramsPythonPython36-32libsite-packagestransformers__init__.py", line 43, in <module>
    from . import dependency_versions_check
  File "C:UsersUserAppDataLocalProgramsPythonPython36-32libsite-packagestransformersdependency_versions_check.py", line 36, in <module>
    from .file_utils import is_tokenizers_available
  File "C:UsersUserAppDataLocalProgramsPythonPython36-32libsite-packagestransformersfile_utils.py", line 45, in <module>
    import numpy as np
  File "C:UsersUserAppDataLocalProgramsPythonPython36-32libsite-packagesnumpy__init__.py", line 138, in <module>
    from . import _distributor_init
  File "C:UsersUserAppDataLocalProgramsPythonPython36-32libsite-packagesnumpy_distributor_init.py", line 26, in <module>
    WinDLL(os.path.abspath(filename))
  File "C:UsersUserAppDataLocalProgramsPythonPython36-32libctypes__init__.py", line 344, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: [WinError 193] %1 не является приложением Win32

Process finished with exit code 1

Использую Python 3.6.0
Винда 64 битная стоит

вот мой код:

from transformers import GPT2LMHeadModel, GPT2Tokenizer

model_name_or_path = "sberbank-ai/rugpt3large_based_on_gpt2"
tokenizer = GPT2Tokenizer.from_pretrained(model_name_or_path)
model = GPT2LMHeadModel.from_pretrained(model_name_or_path).cuda()
text = "Александр Сергеевич Пушкин родился в "
input_ids = tokenizer.encode(text, return_tensors="pt").cuda()
out = model.generate(input_ids.cuda())
generated_text = list(map(tokenizer.decode, out))[0]
print(generated_text)

Кто знает как решить?

Абрахам, 12 годиков

Понравилась статья? Поделить с друзьями:
  • Createinputlayout failed with error code 0x887a0006
  • Createfilemapping error 1006
  • Craftbukkit error unable to access jarfile craftbukkit jar
  • Craft tweaker как изменить крафт
  • Craft the world crash dump ошибка