Get python modules into Visual studio 2015 Community edition - python

Simple problem, made difficult of course , by Microsoft. How do I install sqlite3 or Pmw on my Visual Studio Community version of Python. I normally place the files my self into site packages folder. With Visual studio they talk about packet manager but where is it? Can it really be this hard?

Hopefully you have the Python Tools for Visual Studio plugin installed. If not, go to https://github.com/Microsoft/PTVS to get v2.2. You can also check out a PTVS Getting Started tutorial series on YouTube.
Assuming you have PTVS, right click on your Python Environments in your solution. Add Virtual Environment.
Right click on the env and choose Install Python Package.
Install your Python package.
For SQLite3, you place your .db or .sqlite3 file in your project. If you copied it manually in and you want Visual Studio to "see it" in the Solution Explorer, you may need to right click on the solution name and Add Existing Item...
I also recommend you go to "Tools >> Python >> Python Environments" to bring up a pane where you can explore any Python versions or virtual environments available to this solution. You can see which module are installed, if they're out of date, and search the PyPI directly from there.

Just go to your Python/Scripts folder at the command prompt and "pip install ". You may need an administrator command prompt.
If it's a package with binary components (numpy, etc), you can download and install from here (very useful site): http://www.lfd.uci.edu/~gohlke/pythonlibs/ Just be sure to get the version and 32/64 bit that matches your python.exe.
Within VS2015, Tools - Python Tools - Python Environments. Select an environment from the left side, and you'll see an entry one column to the right 'pip'. Select that. There's now a search box where you can type in the package you want. Then scroll down and select "Install package".

Related

Why can't I choose all of my known Python Environments from Visual Studio Code?

From Visual Studio Code, I can only see the available environments:
Python 2.7
Conda x.x
I have the following self-installed Python versions:
C:\Python\Python2.7\
C:\Python\Python3.7\
Why is Python3.7 not appearing?
Verify that all binaries are on the same admin elevation level
C:\Python\Python2.7\ <--- rarely used, NOT elevated as admin
C:\Python\Python3.7\ <--- frequently used, elevated as admin
VSCode itself was NOT elevated, and therefore only allowed non-elevated binaries to be selected.
After elevating the VSCode binary to admin, all Python environments were available.
The documentation on environments explains how the extension finds installations of Python as well has how to specify the location manually.

Unable to create .feature file in Pycharm Community

I have installed the Pycharm Community edition and installed the behave 1.2.5 with the following command.
pip install behave
It was successfully installed and it is available in the Pycharm Project Interpreter as shown below.
But I don't see an option to create the .feature file (Gherkin file) when I right click on the project
Do I miss anything over here, in Pycharm professional by default Behave BDD is available. How do I configure the behave with Pycharm community.
AFAIK "BDD support is available only in the PyCharm Professional Edition."
Of course, nothing prevents you from creating a file with the .feature extension but you are not going to see options to run your scenarios. You can get some syntax highlighting using the Gherkin plugin and that is as much as you get in the community edition.
how to install gherkin plugin on PyCharm
You can access the Settings by Ctrl + Alt + s and install the gherkin plugin. I just did that and is helping a lot.

System Python conflict between Anaconda and existing Python installation

I've been going with a basic Python3.4 install that I've been installing many modules into for over the past month but have reached a point where pip is coming up short and I'm going to just install the full Anaconda on my system to go deeper into bokeh-server stuff.
I get a popup during the Windows 64bit installer (Anaconda3-2.3.0-Windows-x86_64.exe) saying
A version of Python 3.4 (64-bit) is already at C:\Python34\ We
recommend that if you want Anaconda registered as your system Python,
you unregister this Python first. If you really know this is what you
want, click OK, otherwise click cancel to continue.
Didn't find much documentation on this subject, and I'm not really sure how to "unregister" that installation of Python apart from uninstalling it entirely from Windows which I imagine would accomplish such a thing. Is this basically telling me to check how my Python Launcher for Windows is setup after the Anaconda installation? I'm completely unfamiliar with this notion of python system registration? Is that just a round about warning about which python version takes precedence on the system path, or which installation holds the file associations?
The solution is simply to uninstall python (for example, run the original python installer and select the uninstall option). The python key in the windows registry will be removed (which is what unregister means in this context).
Here is a link to a script that will unregister a Python installation (if you haven't come across it already). I personally have not dealt with anything like this. It seems like it should work, but you may have to tinker around with some of the paths in the script to get things to work. The links in #nightuser 's post will also probably fix the issue.
Why not just remove your version of Python? You could do a pip freeze > requirements.txt with your current Python and add them to Anaconda, or create an environment with Anaconda using those packages. Anaconda has greatly decreased the amount of time I spend setting things up.
You are getting that prompt because you have another version already installed the safe way to do this is going to the directory of the existing version and running the uninstaller. Once the previous version is completely uninstalled. You can run the installation as normal it should works!
enter image description hereYou have already installed python in your environment, so your system can handle your python code. Anaconda can handle your python code as well. If you install Anaconda and expect use python provided by Anaconda, then your system will confuse about assigning the code job. To avoid this confusion, there is always a path to point out which python you want.
You can ask your OS to find specific python by changing your environment path in windows OS:
By deleting the python path your Python will be invisible. Changing path is more convenient compared with the uninstall.
If you got a python compiling software like Pycharm, things are different. Pycharm may have python3.6 while your system got python 3.5. You need to delete path in those software or uninstall python specified by those software.
Pycharm
Actually, instead of registering the Anaconda as the system python, you can install it first, then specify your Pycharm and system path to the Anaconda python path. Thus, your Pycharm will use python provided by Anaconda and package & virtual environment you need.
I edit this for lots of times because I got Great wall, so I can't close something pop up in my screen(cause it is Blank). And everything is missing if I refresh. This is annoying.
My system path Anaconda3's python36
Add path in Pycharm
Or you can't use these packages and Anacon's virtual Environment

Django project won't work with Python Tools Visual Studio

I'm trying to get a Django project working with PTVS. The only reason I'm using it is because I have Azure credits and want to deploy there. In Visual Studio, I go to New Project > Python > Django. I chose "Add Virtual Environment". Here is the screenshot:
After the project is created, this is my solution explorer:
You can see django is definitely installed in the environment. But when I right-click on the app and go to Python > Sync DB, I get a bunch of errors says that
ImportError: No module named django.core.management. All the django package statements are underlined and they can't be imported. Any ideas?
When I go back to create another project and I do "Install into Python 2.7 directory," it works fine. So I don't understand why I can't use the virtual environment.
Go to your Projects folder and delete all the application/projects.
Clean the project directory. (By default this is the PATH: Documents/Visual Studio 2013/Projects
Close all the other IDE's and Programs that might be using your
python interpreter.
Set no-proxy in case you are using some proxy settings because it
will prevent Visual Studio from downloading and installing the required
packages.
You might prefer restarting your machine before performing these steps.
It worked for me. I had the same problem.
Below are two useful tutorials to walk you through the entire process.
PTVS 2.0 Beta: Creating a Django Website : A step by step guide
Django and MySQL on Azure with Python Tools 2.1 for Visual Studio

Canopy with Visual Studio...

Does anybody have documentation on how to set up the Canopy Python environment as an interpreter within Visual Studio? I am new to VS and Canopy so I apologize if this seems trivial. I have read the following sites but still struggling to get Canopy integrated as the interpreter. Currently Python 64bit 2.7 is the only interpreter that shows up.
Install
https://pytools.codeplex.com/wikipage?title=PTVS%20Installation
Environments
http://pytools.codeplex.com/wikipage?title=Python%20Environments
Python Tools for Visual Studio (PTVS) will typically automatically detect Canopy and show it as "Python 2.7 64-bit". You can check to see if it is detecting Canopy by selecting 'Environment Options' in PTVS. The path in 'Path' by default will be something like ...\AppData\User\Enthought\Canopy\User... If this is what it is finding, you should be set.
If the Python interpreter PTVS is finding is not Canopy, then it sounds like you have another version of Python installed. This is ok and there are two options.
If you want it to find Canopy automatically, you need to be running Canopy 1.1 or later and make it your default Python environment. To update Canopy if needed, go to Help -> Software Updates. Then to make it your default Python environment, Edit -> Preferences and click the button to make it your default. This has the effect of changing some Python-standard registry keys.
If you don't want Canopy to mess with your environment, that's completely fine, too. You can get the same effect by clicking 'Add environment' in the PTVS environment options dialog. The settings for a default Canopy install are:
Path: C:\Users\\AppData\Local\Enthought\Canopy\User\python.exe
Windows path: C:\Users\\AppData\Local\Enthought\Canopy\User\pythonw.exe
Lib: C:\Program Files\Enthought\Canopy\App\appdata\canopy-1.1.0.1371.win-x86_64\Lib
Note that the first two point to the 'User' environment whereas the last points into the core install.
The upcoming Canopy 1.2 release in a couple of weeks will include more complete integration with PTVS and Visual Studio that will automate this and remove the need for Canopy to be the default Python environment.

Categories

Resources