[Fixed] "error: –plat-name must be one of ('win32', 'win-amd64', 'win-arm32', 'win-arm64')" with pip on venv while – Psycopg2

by
Ali Hasan
django llama-cpp-python postgresql psycopg2 vagrant-windows

Quick Fix: Run pip install with the –no-use-pep517 flag to skip PEP 517 processing and avoid issues related to platform compatibility.

pip install –no-use-pep517

The Solutions:

Solution 1: Modify setup.cfg

In order to solve this issue update value of –plat-name parameter in your setup.cfg file. Its value should be one of ('win32', 'win-amd64', 'win-arm32', 'win-arm64').

Solution 2: Modifying the Setupcfg File

Open the file setupcfg.py located at the path C:\Aavash files\COMP206\Project\Movie4AllMoods\env\lib\python3.9\site-packages\setuptools\config\setupcfg.py and locate the variable plat_name.

Replace None in self.plat_name = None with your platform’s version:

  • For a 64-bit system: 'win-arm64'
  • For an AMD processor: 'win-amd64'

You can find the available platforms listed in the PLAT_TO_VCVARS variable in the same file.

Next, find another code block that contains plat_name:

def initialize(self, plat_name=None):
    ...
    if plat_name is None:
        plat_name = get_platform()
    ...

Again, replace None in plat_name = None with your platform name.

After making these changes, save the file. This should resolve the error: --plat-name must be one of ( error when installing psycopg2.

Solution 3: Set plat-name according to platform

The error message suggests that the --plat-name must be one of 'win32', 'win-amd64', 'win-arm32', 'win-arm64'. You can set the --plat-name to the appropriate value for your platform using the PLATNAME environment variable. For example, if you are on a 64-bit Windows system, you can set the PLATNAME environment variable to 'win-amd64' as shown below:

set PLATNAME=win-amd64
pip install psycopg2

Q&A

Is there any linux command on this issue?

Yes, you can run ‘SETUPTOOLS_USE_DISTUTILS=stdlib pip install <your package name>’.

I have already tried most of the solutions. What else can I do?

You need to change the self.plat_name from None to your platform name in C:\Aavash files\COMP206\Project\Movie4AllMoods\env\lib\python3.9\site-packages\setuptools\config\setupcfg.py.

How to resolve on Windows 11 with Python 3.10.5?

Update Python version to 3.11.7.

Video Explanation:

The following video, titled "New Hope Club - Fixed (Official Video) - YouTube", provides additional insights and in-depth exploration related to the topics discussed in this post.

Play video

Listen to the new EP from New Hope Club!!! #WelcomeToTheClub https://NewHopeClub.lnk.to/WelcomeToT... New Hope Club Instagram ...