I just installed the new VS2017 Preview and imported a Python project. This project has many import statements but VS2017 does show error in some import packages like cv2, socketio, eventlet, eventlet.wsgi. This Python project runs fine, out of VS2017, in my Anaconda environment. Do I need to install OpenCV 2, socketio, etc in Windows? Or is there a solution like pip, anaconda, apt-get, in the VS2017 environment that can automate the installation of unresolved package?
I also noticed that it is possible to add Anaconda to VS project created. Can this Anaconda inside VS help to install the missing packages?
Regards.
You can, however it is not perfect.
Firstly you need to bring up the Python Environments menu which can be accessed by going:
Tools -> Python -> Python Environments
It should bring up a sidebar (depending on how you have VS setup). There should be a dropdown box about half way down with the text "Overview". Click on that and you can select "Packages". This will bring up a textbox under it that will allow you to use standard pip commands to install packages.
If you are on Windows though there is one added step for some packages though. As pip does not work well on Windows, due to the fact that the standard Windows package site (PyPI) does not yet have Windows wheels for a lot of common packages.
Therefore, you are best off going to Christoph Gohlke's unofficial package site and then downloading the package you need. Once it's downloaded locally just copy and paste the LOCAL address into the textbox under "Packages". It will then install the package and you'll be good to go.
I had same problem and i could get it working with visual studio 2017 python v3.6 using following instructions
Install appropriate .whl file using this link
(cpMN where you have Python M.N). contrib includes OpenCV-extra packages. For example, assuming you have Python 3.6, you might download **opencv_python-3.2.0+contrib-cp36-none-win_amd64.whl**
link to download
Then install it by running this command from installed folder
pip install opencv_python-3*win_amd64.whl
Related
I am on Linux Mint. When i try to import robot for robotframework in my python application it doesnt get recognized as a installed library. This while i checked the executable with the "which" command.
which python
Gives the output: /usr/bin/python
I put that path '/usr/bin/python' in the interpreter path in vscode. But it doesn't get
the installed libraries.
when i use the terminal outside of vscode and do
pip list
I get a big list with all of my installed libraries. But when i do the same in VScode i just get a short list with nothing of the installed libraries.
I tried to deinstall python, vscode and reinstall both but that doesn't work. The python path to the system python.exe is in the PATH variables. I dont know what i can try further.
It looks like that they both point to the same pip instance but it doesn't recognize the same packages. Like it cant find the site-packages folder
Can anyone please help?
I've found the problem.
In Linux Mint when you install visual studio code via the application manager built into the OS. It installs the flatpack version of Visual studio code. Which creates what looks like its own environment that cannot get the pip packages from the main system.
For me what solved it was to download the .deb version from the official vscode website(https://code.visualstudio.com/Download) and install that one using the:
sudo apt install /Downloads/{name of downloaded.deb file}
When I used this version of Visual studio code it all worked for me with no problem.
I am using code-server which runs vscode in a web browser. It is served through a cluster running linux/ubuntu. The install includes many ros packages which are installed in /opt/ros/noetic/... in other words they are part of the Robot Operating System. They were not installed with Pip but with apt-get install xxx.
In this copy of vscode I have installed the ms-python extension and it works well. I see pop ups with helpful information on everything. Except libraries that were defined outside of pip.
I am not sure how to configure things so that ms-python sees all these libraries.
I think this issue can help.
You can set pythonpath (where your package is) in the setting.json to get the package under the other directory.
I'm trying to install a python package (specifically pandas) into Visual Studio code on a chromebook's linux virtual machine. I've tried many different things but none of them seem to work: trying to use pip install pandas results in bash: pip: command not found. I have no idea where the actual python interpreter is located, so I can't go to the source. I thought it was that I wasn't using the correct terminal, but the only other option is JavaScript Debug Terminal. What am I doing wrong? Is it even possible?
Pip is a python package management tool, which provides the functions of finding, downloading, installing and uninstalling Python packages. However, this tool is not included in the system and needs to be installed manually. Here is the official website of PIP, which contains installation instructions.
I just installed the new VS2017 Preview and imported a Python project. This project has many import statements but VS2017 does show error in some import packages like cv2, socketio, eventlet, eventlet.wsgi. This Python project runs fine, out of VS2017, in my Anaconda environment. Do I need to install OpenCV 2, socketio, etc in Windows? Or is there a solution like pip, anaconda, apt-get, in the VS2017 environment that can automate the installation of unresolved package?
I also noticed that it is possible to add Anaconda to VS project created. Can this Anaconda inside VS help to install the missing packages?
Regards.
You can, however it is not perfect.
Firstly you need to bring up the Python Environments menu which can be accessed by going:
Tools -> Python -> Python Environments
It should bring up a sidebar (depending on how you have VS setup). There should be a dropdown box about half way down with the text "Overview". Click on that and you can select "Packages". This will bring up a textbox under it that will allow you to use standard pip commands to install packages.
If you are on Windows though there is one added step for some packages though. As pip does not work well on Windows, due to the fact that the standard Windows package site (PyPI) does not yet have Windows wheels for a lot of common packages.
Therefore, you are best off going to Christoph Gohlke's unofficial package site and then downloading the package you need. Once it's downloaded locally just copy and paste the LOCAL address into the textbox under "Packages". It will then install the package and you'll be good to go.
I had same problem and i could get it working with visual studio 2017 python v3.6 using following instructions
Install appropriate .whl file using this link
(cpMN where you have Python M.N). contrib includes OpenCV-extra packages. For example, assuming you have Python 3.6, you might download **opencv_python-3.2.0+contrib-cp36-none-win_amd64.whl**
link to download
Then install it by running this command from installed folder
pip install opencv_python-3*win_amd64.whl
I am using PyCharm community edition 2018.2.
Code completion works fine but just for installed modules if I install external library code completion doesn't work for them. However I have no problem with running code based on them.
I checked that my PyCharm is not in the 'PowerSafeMode'.
I have created project both for main and local Python interpreter.
In the IDE I also try to select installed libraries as a source.
I tried this for PIL library and OpenCV library.
Anyone has and idea what I might be missing or doing wrong?
Didn't you installed opencv via terminal?
For example, like this.
$ pip install opencv-python
$ pip install opencv-contrib-python
When I installed opencv through terminal, experienced the same problem.
If so, please try this.
1.Create new Pycharm Project, with new environment using Virtualenv.
2.Install opencv through Pycharm.
File -> Settings... -> Project interpreter -> +