Gym cannot be installed in Pycharm Project Interpreter

Asked 2 years ago, Updated 2 years ago, 99 views

Gym cannot be installed on Pycharm's Project Interpreter.

 numpy.distutils.system_info.NotFoundError: Norapack/blas resources found.

I get an error.What is the solution?

add

I am using Windows 10, Python 3.8.1.
I was able to install it by typing pip install gym at the command prompt, but I was unable to import the gym when I ran the program.
Therefore, when I tried to install Gym from Project Interpreter, I encountered a problem similar to the one above.

Also, on my senior's computer, I ran the same program and it worked properly.

python pip pycharm

2022-09-29 21:47

2 Answers

Before you answer, it appears that the reason is that the pip and setuptools versions in the new virtualenv environment that PyCharm creates are out of date (or are they not fully deployed?)

If the project interpreter was Python 3.8, pip-19.0.3-py3.8.egg and setuptools-40.8.0-py3.8.egg were in the new virtualenv environment, and setuptools-40.8.0-py3.8.egg remained undeployed.

When I installed "gym" from the "Project Interpreter" in the "Settings" menu, I encountered a question error and could not install it.

The solution should be one of the following:

  • Pre-build an environment with the original Python and virtualenv (or pipenv or conda) that are not PyCharm, and select the environment as an "existing interpreter" in PyCharm project creation
    It's @akiraejiri's method.
    In that case, let's keep pip, setuptools, and virtualenv up to date before working.
    Dear @akiraejiri, You can install Gym first as the answer.
    If pip,setupools are up to date, it seems that Gym can be installed with PyCharm later.

  • Increase the number of pip,setuptools versions in the new PyCharm virtualenv environment
    It is troublesome and requires a lot of steps, but you can also install Gym using this method.

Pre-build an environment with the original Python and virtualenv (or pipenv or conda) that are not PyCharm, and select the environment as an "existing interpreter" in PyCharm project creation
It's @akiraejiri's method.
In that case, let's keep pip, setuptools, and virtualenv up to date before working.
Dear @akiraejiri, You can install Gym first as the answer.
If pip and setupools are up to date, Gym can be installed later with PyCharm.

Increase the number of pip,setuptools versions in PyCharm's new virtualenv environment
There are many troublesome and many steps required, but you can install Gym using this method.

However, I was able to install it, but I may still be missing something because I'm stuttering with a simple program running ahead.

How to create something other than PyCharm first:

  • Working with command prompts with Python 3.8 or Scripts in PATH
  • Run
  • pip list-o to update any old ones to the latest version
  • C:\Users\Username\PyCharmProjects folder
  • Run virtualenv-p Python 3.8 project name to create a new environment
  • Run the project name\Scripts\activate.bat to migrate your Python environment
  • Run pip list-o and update any old ones to the latest version
  • Install Gym if desired
  • Specify the project name created above in creating a new PyCharm project and select "Existing Interpreter" to specify the environment created above
  • Install gym under <+> under Settings > Project Interpreter on the menu
  • If there is a package with an increased number of editions, I will upload it

Update your PyCharm environment:

  • Increase pip to 20.0.2 in Project Interpreter under Settings on the menu
  • From now on, work in the lower left terminal of PyCharm
    • Go to cd lib\site-packages
    • rd/s/q pip-19.0.3-py3.8.egDelete Folder
    • cd..\.. Back
    • Download the latest pip wheel pip-20.0.2-py2.py3-none-any.whl to the folder
    • Install with py-mpip install-Upip-20.0.2-py2.py3-none-any.whl
    • Go to cd lib\site-packages
    • Delete easy_install.pth and setupools.pth files in
    • del*.pth
    • cd..\.. Back
    • Download the latest wheel setup tools-46.1.3-py3-none-any.whl from setuptools to the folder
    • Installing pip install-U setuptools-46.1.3-py3-none-any.whl
    • Go to cd lib\site-packages
    • delete files in del setuptools-40.8.0-py3.8.eg
    • Delete Folder in rd/s/q__pycache__
    • delete files in delete_install.py
    • cd..\.. Back
    • Delete each wheel in del*.whl
  • Remove cache from menu/PyCharm restart
  • Install gym in the
  • menu Settings Project Interpreter
  • If there is a package with an increased number of editions, I will upload it
  • Go to cd lib\site-packages
  • rd/s/q pip-19.0.3-py3.8.egDelete Folder
  • cd..\.. Back
  • Download the latest pip wheel pip-20.0.2-py2.py3-none-any.whl to the folder
  • Install with py-mpip install-Upip-20.0.2-py2.py3-none-any.whl
  • Go to cd lib\site-packages
  • Delete easy_install.pth and setupools.pth files in
  • del*.pth
  • cd..\.. Back
  • Download the latest wheel setup tools-46.1.3-py3-none-any.whl from setuptools to the folder
  • Installing pip install-U setuptools-46.1.3-py3-none-any.whl
  • Go to cd lib\site-packages
  • delete files in del setuptools-40.8.0-py3.8.eg
  • Delete Folder in rd/s/q__pycache__
  • delete files in delete_install.py
  • cd..\.. Back
  • Delete each wheel in del*.whl

The installation and import have been completed, but it has been stumbled by a simple program execution ahead.
Either way, the following program on the first page of the site below has encountered an exception in env.render() and has not been able to run.
Gym

import gym
env=gym.make("CartPole-v1")
observation=env.reset()
for_in range (1000):
  env.render()
  action=env.action_space.sample()#youragenthere(this takes random actions)
  observation, reward, done, info=env.step(action)

  if done:
    observation=env.reset()
env.close()

_get_pixel_format_descriptor_matching_configs, win32.py:102 pf=_gdi32.ChoosePixelFormat(canvas.hdc,byref(pfd)) and __exception__(<class'OSError'>, OSError('exception:'accordingCad00000000DC

I don't know anything about Gym myself, so maybe I still don't have enough packages or settings.


2022-09-29 21:47

Use Project Interpreter with Gym.
 Select or create a new Project Interpreter containing Gym.

Prerequisites

At a Windows 10 command prompt, do the following to install Gym:

 pip install gym 

Step

Click the Settings (Ctrl+Alt+S) gear icon and select Add.
 Select Virtualenv and create a Project Interpreter.
  VWhen I selected Virtualenv, the package list contained Gym.
   As long as Gym is included, I think other options are fine.
   In my environment, neither the system interpreter nor the Anaconda Project Interpreter contained Gym.

The above reference was given to Python interpreter.


2022-09-29 21:47

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.