Unable to install arcpy module using Pycharm - python-2.7

I realize this has come up before, but all the responses I've found were for different versions of Arc.
I have followed the steps from this link and set my project interpreter to python c:\Python27\ArcGIS10.4\python.exe. Based from what i've read, that should be set up with Arcpy pre-installed. However, if I look at the packages in the VENV, arcpy isn't listed. I've tried adding it using pip and the pycharm GUI package manager. There isn't a package just named arcpy, the options are:
arcpy-metadata
arcpy-virtualenv
arcpyext
arcpylogger
I have successfully installed all of them and they show up in the package list of the project virtual environment. Despite this, I still get "no module named arcpy" as an error when I go to run a script.
Any ideas about where i'm going wrong?
Thanks for your help.

So I've spent a while looking over the issue and using Conda as your project Interpreter is the fix to your issue. I've tested it myself as well. Here are some clear instructions on how to correctly install Conda and set up the environment in Pycharm:
To create a Conda environment:
Ensure that Anaconda or Miniconda is downloaded and installed on your computer, and you're aware of a path to its executable file.
(Refer to the installation instructions for more details.)
Press Meta+Comma to open the project Settings/Preferences.
In the Settings/Preferences dialog Meta+Comma, select Project | Project Interpreter. Click the The Configure project interpreter icon and select Add.
In the left-hand pane of the Add Python Interpreter dialog, select Conda Environment.
The following actions depend on whether the Conda environment existed before.
If New environment is selected:
Specify the location of the new Conda environment in the text field, or click Conda environment location and find location in your file system. Note that the directory where the new Conda environment should be located, must be empty!
Select the Python version from the list.
Specify the location of the Conda executable file in the text field, or click Conda executable location and find location in the Conda installation directory. You're basically looking for a path that you've used when installing Conda on your machine.
Select the Make available to all projects checkbox, if needed.
If Existing environment is selected:
Expand the Interpreter list and select any of the existing interpreters. Alternatively, click Select an interpreter and specify a path to the Conda executable in your file system, for example, C:\Users\jetbrains\Anaconda3\python.exe.
Select the checkbox Make available to all projects, if needed.
Click OK to complete the task.

Related

Opening an existing Django project with VS Code through Anaconda

I installed Django and started a project via cmd yesterday. Today I installed Anaconda with VS Code and I now want to open my Django project in VS Code through Anaconda.
Is this possible? Id like Anaconda to be my interface for all my projects regardless of what they are. Is this possible?
thanks
V
I myself use Anaconda Environment in VSCode for Data Science Projects.
For this, first you need to prepare a virtual env from Anaconda. Here is the tutorial for it in the official documentation : https://code.visualstudio.com/docs/python/environments
Follow this tutorial as it is without missing any line of code they ask you to.
Once you are done setting it up. You just need to start your Django Project in VSCode.
At the bottom where you see Python just click on it and Select Interpreter. From their, a list of virtual envs and Python envs opens up choose the one you created from Anaconda.
You have anaconda libraries working in your project now.
You can also start Jupyter notebook in VSCode : https://code.visualstudio.com/docs/python/jupyter-support#_create-or-open-a-jupyter-notebook
This way you can purely shift to VSCode for all of your stuff.
Thank you

How to install older Django

I am using Pycharm and want to install an older version of Django. However, PC only seems to install V2. How can I configure Pycharm to install an older version?
This is about installing an older version, NOT changing a version that has already been installed. I want to configure Pycharm to INSTALL a specific version.
Specifically for installing through PyCharms UI, you can specify which version of a package you want to install in the package manager. Navigate to
File -> Settings(or Preferences on MacOs) -> Project: [project name] -> Project interpreter
and click on the + sign under the cog icon. Then search for Django and specify the version you want to install from the drop down menu below the Description field.
However, if you want to install a different version through the terminal, you should write something along the lines of
pip install Django==[your_version]
As far as I know, there is no way to change the version on creating a new project unless you use your own interpreter when creating a new project.
So you can first create your virtual environment with the django version you want, and then select that venv when creating a new django project:
virtualenv venv
source venv/bin/activate
pip install django==2.1
When you want to create a new project, select Existing Environment instead of New environment using... and use your custom venv.
It's not possible at the moment. The only workaround, as mentioned by Pedram, is to use the existing interpreter with needed version of Django installed.
I filed a feature request about that, feel free to vote and leave comments.
You may also find useful the following feature request https://youtrack.jetbrains.com/issue/PY-33804

Leiningen cannot find SDK

I'm trying to install Leiningen from here https://djpowell.github.io/leiningen-win-installer/. But it cannot find SDK. If I check "Custom path" then it gives an out of range error on the next screen. Both Java and SDK are installed.
that installer automates these steps (from the project page)
The installer makes curl.exe available so that leiningen can download and upgrade files.
The installer downloads and installs the latest lein.bat from github.
lein.bat is added to your PATH variable.
LEIN_JAVA_CMD is set to point to your selected JDK, and the :java-cmd property is set in your user profile in profiles.clj.
lein self-install is run to install the Leiningen JAR file.
The uninstaller will remove the files that were installed, together with the Leiningen self-installs and search indexes; the environment variables that were set, and the additions to the PATH.
A likely area for this to do wrong is the setting of LEIN_JAVA_CMD and the :java-cmd key in the leiningen profile.clj file.
I'd first check:
the java path is correct in the value of the LEIN_JAVA_CMD environment vatiable
check the profiles.clj file in your home dirctory for conflicting JRE paths
uninstall that installer and do it by following the instructions at https://leiningen.org/
also note that Clojure only required the java runtime JRE and does not require or use the JDK. differing versions and paths between these has caused problems as well.

Pycharm interpreter error for Flaskr application (official Flask tutorial sample)

My context
I'm educating myself with Python Flask via the official tutorial.
I'm using Pycharm IDE (community edition) in Ubuntu Destkop 16.
The issue
I open the sample code of this tutorial as a Pycharm project
Got the Invalid Python interpreter error as below snapshot
My question
How can I fix it?
It's looking for a functional Python installation.
If you open the 2 drop-down you've referenced you'll see a selection of Python installations on your machine.
The better option though, is to create a virtualenv for your current project, so click on the cog icon to the right of the Project Interpreter drop-down and click Create VirtualEnv and follow the prompts.
Once created, it should pick that VirtualEnv as the default Python interpreter for that project and your error will disappear, though remember, because it's a new virtualenv, it won't yet have Flask etc installed on it. You can install the Flask library by clicking the + icon underneath the cog and searching/installing for Flask.
Alternatively, create a requirements.txt file on your project root directory, with Flask as the contents, and PyCharm will notice that next time you are in a .py file and suggest to automatically install Flask.

How apps installed at pip really works?

I'm new at django and i was looking for a wysiwyg and i fuond tinymce.
I installed at pip command line and i expect that create a folder at my folder project like a new app. It dont created no one folder but i did the next steps and for my surprise the app works fine at my project.
I want to know how this app really works at my project, in case im gonne deploy this project and how to deploy the app installed at pip or something like that.
My englhish is not good but i hope that was clear.
The applications, or libraries rather are copied directly inside one of the folders inside your python directory called Lib/site-packages. This exact location depends on your operating system you can find usually find your newly installed packages under
For Windows
C:/PythonXX/Lib/site-packages/
For Linux
/usr/local/lib/pythonX.Y/site-packages
When you run a python script, Python will automatically include these folders as available resources, and when you add for example import X to your code, it will check to see if X is listed.
You have more information on the topic available here.