How to start a new Python Project using Pycharm and Conda on ubuntu
In Getting Started with Python on Ubuntu we set up a Ubuntu desktop to make use of Anaconda and the Conda package and environment management system to quickly and easily create development environments for your Artificial Intelligence and Machine Learning projects.
In this post we’ll expand on this and walk-through the process of creating a new python project making use of Conda in Pycharm – The Python IDE for Professional Developers.
Starting a new Conda project in Pycharm
Open Pycharm and select File -> New Project this show the new project Dialog box. In this example we will simply create a Pure Python project
If it is not expanded , then expand the Project Interpreter:
The select the New Environment using option button which will enable the drop down selection box and you should be able to select Conda
Ensuring you select the appropriate path you would like your new project and environment created you can then select the Create button.
Pycharm will now create the project for you.
If you would like to configure an existing project check out Configuring a Conda Environment
Your new environment should now be prepared and you are now ready to start coding.
Install Project Dependencies
In order to start developing an application we will need to install whatever dependencies we need for the project. In this example we are just going to develop a simple application which will extract text from Word Documents contained in a directory in the project folder. For the purpose for the example we’ll simply create a directory called documents and populate it with some word documents.
In order to extract the contents of the documents, we’ll make use of a popular Python library textract .
In order to use textract we will first need to install it to our environment. So can open the integrated terminal window ( alt + f12) and install our package using Conda
Conda will install your package, it will also ask you to confirm your choice.
Lets create a simple Python file in our project and name it extract.py . To do right click project folder in the project view and select New -> Python File
We can now write the code we need to create our simple example
Run and Debug your Project
We can now run and debug our project, in order to do so we will need to create configuration.
Open the Run/Debug Configurations using Run -> Edit Configurations
Click the + in the right hand corner then select Python then select the Script path: the path where your extract.py
We can now set a break point in our code and if we run start a debug session our code will stop on break point and we can step through as required.
It’s super easy to use Pycharm and Conda together to create Python projects and use Conda to manage our project dependencies.
A unique background as business owner, marketing, software development and business development ensures that he can offer the optimum business consultancy services across a wide spectrum of business challenges.
Latest posts by Gary Woodfine (see all)
- How to convert Word Documents to Text Files with Python - May 22, 2019
- How to start a new project using Vue.js - April 29, 2019
- How to install DynamoDb on local Ubuntu Development - April 17, 2019