29

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

Thanks

1

11 Answers 11

15

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 ...

1
  • I just changed ides to pycharm years ago.... i got fed up with eclipses bugginess Nov 23, 2017 at 17:14
14

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.
1
  • You may create the project in step 2 with any name. After copying the .project' and .pydevproject` files to the target project directory, just edit .project file in something like vim to swap in the appropriate project name into the <name> tags; i.e. <name>PROJECT_NAME</name>.
    – Dut A.
    Sep 13, 2021 at 5:44
10

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.

1
  • I assume the problematic import-based 'solutions' would include the drag-and-drop one? And the "open the .proj file" one?
    – Jon Coombs
    Dec 9, 2014 at 0:58
9
  • 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.
1
  • 3
    -1 This gives me '.project found in ... (Use the project import wizard instead'
    – James
    Aug 11, 2014 at 13:36
4

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.

3

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

3
  • Are you sure it is correct, since the python project is not the existing Eclipse project? Oct 16, 2013 at 18:25
  • 3
    -1 Using this method, Pydev fails to recognise packages instead of just folders.
    – James
    Aug 11, 2014 at 13:40
  • 1
    Thinks for your answer,and to see Joran Beasley's answer if the project is not exist.
    – shuiyouren
    Oct 17, 2014 at 3:31
1

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.

1
  • thanks, this solution worked for me. The python interpreter was not found after import, but could easily be fixed by right-clicking on the project then going in Properties/PyDev - Interpreter/Grammar / "Click here to configure an interpreter not listed"
    – sc28
    Jan 22, 2019 at 0:39
1

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

0
0

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...

0

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

1
  • That did not work for me, Eclipse said that it could not found any projetcts! Maybe there is a project file missing? EDIT: Somehow the files .project and .pydevproject where missing so Eclipse had not been able to see any project. Must change my .gitignore file...
    – Pille
    Apr 26, 2015 at 12:50
0

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.