How do I import a pre-existing python project into Eclipse?

Question:

I am using eclipse for python.
How do I import an existing project into eclipse in the current workspace.

Thanks

Asked By: Shan

||

Answers:

New Project

Dont use default Location

Browse to existing project location …

if its an existing eclipse project with project files that have correct paths for your system you can just open the .proj file …

Answered By: Joran Beasley

Following are the steps

  • Select pydev Perspective
  • right click on the project pan and click “import”
  • From the list select the existing project into workspace.
  • Select root directory by going next
  • Optionally you can select to copy the project into

thanks

Answered By: Shan

I just suffered through this problem for a few hours. My issue may have been different than yours…Pydev did not show up as an import option (as opposed to C projects). My solution is to drag and drop. Just create a new project (name it the same as your old) and then drop your old project into the new project folder as displayed in eclipse…3 hours later and it’s drag and drop…

Answered By: Tyler
  • make sure pydev interpreter is added, add otherwise
  • windows->preferences->Pydev->Interpreter-Python

  • then create new pydev project,

  • give the same name
  • then don’t use default location, browse to point the project location.
Answered By: ranjeetcao

At time of writing none of the given answers worked.

This is how it’s done:

  1. Locate the directory containing the Pydev project
  2. Delete the PyDev project files (important as Eclipse won’t let you create a new project in the same location otherwise)
  3. In Eclipse, File->New->Pydev Project
  4. Name the project the same as your original project
  5. For project contents, browse to location containing Pydev project
  6. Select an interpreter
  7. Follow rest of the menu through

Other answers using Eclipse project importing result in Pydev loosing track of packages, turning them all into folders only.

This does loose any project settings previously set, please edit this answer if it can be avoided. Hopefully Pydev devs will add project import functionality some time.

Answered By: James

This can easily be done if you keep you project in a git repository. The following is working with Linux but should be ok with Windows as well:

Clone your project from the repository:

git clone https://url/of/project/file.git

(if you don’t keep your project on a free git server like github or bitbucket, you can create a new local repository by changing directory into an existing project folder and typing git init)

Then open eclipse and go to File > Import > Git > Projects from Git > Existing local repository > (select your project or add it) > Next > Finish

Answered By: f.cipriani

After following steps outlined by @Shan, if the folders under the root folder are not shown as packages,

  • Right-click on the root folder in PyDev Package Explorer
  • Select PyDev > Set as source-folder

It will add the root folder to the PYTHONPATH and now the folders will appear as packages

Answered By: Asif Rehan

In my case when i am trying to import my existing perforce project , it gives error no project found on windows machine. On linux i was able to import project nicely.

For Eclipse Kepler, i have done like below.

  1. Open eclipse in pydev perspective.
  2. Create a new pydev project in your eclipse workspace with the same name which project you want to import.
  3. By now in your eclipse workspace project dir , you must be having .project and .pydevproject files.
  4. Copy these two files and paste it to project dir which you want to import.
  5. Now close and delete the pydev project you created and delete it from local disk as well.
  6. Now you can use import utility to import project in eclipse.
Answered By: shashaDenovo

Copy these two files from some existing pydev eclipse project to root folder of new project which you want to import in eclipse.
.project
.pydevproject

Open .project file in notepad and change name to your_project_name.
If you don’t have these files then you can create them yourself.

Open eclipse, click File -> Import.
New window will open. Now select ‘Existing Projects into Workspace’ under ‘General’ and click Next.
On new window browse to project root directory and select root folder. Then click finish.

Check this tutorial for complete solution.

Answered By: Waqas Ali

First of all make sure that you have the same Python interpreter configured as the project has. You can change it under:

Window > Preferences > PyDev > Interpreters > Python Interpreters

As long the project was created using Eclipse you can use import functionality.
Go to:

File > Import… > General > Existing Projects into Workspace

Choose Select root directory: and browse to your project location. Click Finish and you are done.

Answered By: Michael Dz

Create a new project with in Eclipse and copy the two files .project and .pydevproject to root directory from your Python project, then edit the .project file and replace the name project by the name of your python project.

Then go and import your python project

.project file to edit

Answered By: BenjamínS
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.