Reputation: 67
Trying to run an example of a python arcade library game.
Paste the code to Pycharm: the line 'import arcade' fails because 'The Arcade Library requires Python 3.6 or higher.' . Try again with python3.7 interpreter, now it says 'No module named arcade' but Pycharm proposes to install the package. After input my sudo password, it says that the
'pip install arcade'
failed and to "make sure that you use the correct version of 'pip' installed for your Python interpreter located at '/usr/local/bin/python3.7'"
I open Terminal, try:
sudo pip3.7 install arcade
Installation fails because:
Could not fetch URL https://pypi.org/simple/arcade/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/arcade/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping
Could not find a version that satisfies the requirement arcade (from versions: )
No matching distribution found for arcade
You are using pip version 10.0.1, however version 18.1 is available. You should consider upgrading via the 'pip install --upgrade pip' command.
Lookup how to upgrade pip, find this thread, try every answer, none of them work because of the same reason: SSL module not available.
I also have to go back to the 3.4 interpreter in PyCharm because numpy cannot be used either. Am I stuck with my current version of python (3.4.3)? What do I have to do to install the latest modules?
OS is Linux Mint 17.3 In Terminal, default is 2.7.6 when typing 'python -V' and 3.4.3 when typing 'python3 -V', so need to specify 'python3.7'. Same goes with pip? (write pip3.7 instest of just pip or pip3?)
Upvotes: 2
Views: 2519
Reputation: 497
it is recommended to use virtual environments when you have to satisfy different dependencies while working on different projects. You can use conda to get things done easily.
Type pip install conda
to install conda. Conda can be used to set up new environments as well as installing packages. After installing conda create an environment as follows :
conda create --name nameofenv python=3.4
Change nameofenv to the name of the environment you want. Here I am creating an environment with python version 3.4. If you want to install the latest version of python, just remove the version numbers along with the equal to sign as follows :
conda create --name nameofenv python
The new environment will be created. You can activate this environment as follows in linux:
source activate nameofenv
After activating the environment you can use pip or conda to install the packages you want in to the new environment. The next time you open the terminal you need to activate the environment again to use it.
Now, you can select the environment for the project in Pycharm by going to File->Settings->ProjectName->Project interpreter. Click on the plus sign on the right side and now you have a window open to select the virtual environment. Click on the radiobutton that says existing environment and browse to select the environment under python folder in home folder if it is setup there. PythonFolder->envs->Folder with the same name as the environment that you have created earlier. Done.
Upvotes: 1
Reputation: 848
You can make sure you're loading the correct pip by calling it through the target python executable like this:
python3.7 -m pip install arcade
If the error persists you can try to download the binaries and configure, make, make altinstall (you can find a guide here). The key is not to try and install python through the package manager, since the repo for 14.04, 16.04, 17.03 are not pointing to the latest 3.x version of python.
When you have working versions of the python 3.x you can create virtual environments in PyCharm (as Arun Otaku suggested).
Upvotes: 1