I can’t get Kivy to work in Visual Studio - visual-studio

I’ve installed Kivy with Python and when I check the version it confirms that it’s there. But when I try to use files in VS, I get the message “kivy files require # kivy”.
I’ve searched for solutions to this but I can’t find anything.
Thanks
Thomas

I had a similar problem early on. What worked for me is as follows:
Going to Terminal or Command Prompt and typing
python3 -m pip install kivy
or
python3
then
>>> pip install kivy
I used another IDE called Mu Code (for Python) and tried it there. If it works for one application, it should work for all of them. Some other applications (like Mu) have a feature called the REPL, a read-evaluate-print-loop, that works like a python version of the terminal.
Also, be sure to check that you have correctly installed the latest version of Python. As of time of writing, the most current Python version is 3.10.5. You can download it from https://www.python.org/downloads/.
You can also try using the Python IDLE.
You can check if it's installed by using python3 -m kivy at the command line.
In the end, what worked for me was a lot of troubleshooting.
Hope that was helpful.

Related

No module named 'xlsxwriter'

I'm trying to install xlsxwriter. I'm using VS Code. I installed two different versions of python when I set this up. When I use 'pip install xlsxwriter' it says it's successfully installed, but when I run the code it brings back the above error. (No module named 'xlsxwriter') I'm using 'import xlsxwriter'.
I've tried uninstalling it, installing wheel, and then trying to install it again, but I'm getting the same error.
How do I make sure I'm installing xlsxwriter correctly?
thank you!
I've been able to get the file to run by typing, 'python3 (file name)' but is there a way to change what vs code automatically runs? when I type, 'python --version' it comes back as 2.7.
I'm looking in the command palette, but I'm not seeing python3. I'll keep looking around online, but any help would be wonderful.

ModuleNotFoundError Despite Installing with pip

mac os Catalina, python3.8.2
Hey All,
I know there are similar questions about this, but they didn't seem to help me. I installed a module (quandl) using pip3.8 install. Then I try to import quandl in a .py file and get a ModuleNotFoundError. I do have multiple versions of python installed, can't figure out how to get rid of them safely, hence why I used pip3.8 install to make sure it points to the write place. Still no dice. I am not using a venv.
From the terminal, this is the pip3.8 install path: /usr/local/lib/python3.8/site-packages
From the .py file via VScode, I am interpreting using: /usr/local/bin/python3.8
Can someone educate me on what I am doing wrong?
I was previously interpreting from /Library/Frameworks/Python.framework/Versions/3.8/bin/python3, but I noticed pip was not installing there.
At the bottom of your VSCode window, there's an orange status bar. Starting at the far left, you'll see your git repo info, the git status, and then the Python environment you're using. If you click that, VSCode will slide in a modal dialog window that'll let you choose your python environment -- my VSCode defaulted to /usr/bin/python3, but my pip3 (and python3) are in /usr/local/bin. Once I picked the correct interpreter, I stopped getting the ModuleNotFoundError

Can't get pip working with psychopy install

I am very new to python and plan to use psychopy quite a lot. I am on a work computer but have full admin rights.
Psychopy came with python version 2.7.11 and includes setuptools already.
I am trying to install the selenium module, but having trouble getting pip to work at all.
In cmd, it is recognising the 'python' command, so I know python is in my path.
I get the message "can't open file 'pip': [Errno2] No such file or directory" from:
python pip install selenium
I get " 'pip' is not recognised as an internal or external command" from:
pip install selenium
When I change directory to where pip is located, I get:
Fatal error in launcher: Unable to create process using '"'
Using pip2 makes no difference.
It seems a simple thing but where am I going wrong with this?!
I never really got to the bottom of this, but this is what I found out and here are the commands that worked for me in Windows. Be aware that I am far from expert!
To run python scripts (*.py) from command line (cmd) then C:\PsychoPy2 and C:\PsychoPy2\DLLs need to be in path. ('Path' contains directories or file extensions that can be more globally accessed, i.e. do not require you to change the prompt to the relevant directories first).
To check, open cmd and either type echo %PATH% or just type python. (If python starts, the line will say >>>. You can exit by typing quit())
To add to path, get properties of computer, then advanced system settings, then environment variables.
To check pip.exe (a sort of installation wizard) is installed, either search for the file, or check C:\PsychoPy2\Scripts for it. This may also need to be in path.
To reinstall the latest versions of pip and setup tools, I went to cmd and typed:
python -m pip install -U pip setuptools
If the same code did not work for other modules (which in my case was due to network access), then I downloaded the wheel file (*.whl) for that module (from their website) and ran the following code:
python -m pip install c:/modulename.whl
These may not be the correct ways of doing things, but they worked for me when I couldn't get other ways to work!
I've just had the exact same issue with the pip install, and a conflict with PsychoPy installations. I think it's because python automatically wants to call on the path that's been set by Psychopy, so it can't get to the 'pip' folders that for me, remain in a temporary/hidden file. This wasn't intuitive for me - on any machine without psychopy python just 'works' when you download it.

Python 3.6 Mac OS X - How do you get PIP install?

In various educational guides, I have been guided to install Python modules with an easy one-line command entered in the terminal: pip install whatever
Well, when I type "pip install" it is not found.
Elsewhere in Stack Overflow the following instructions have been given:
Use apt-get -- but I am not using linux
Use easy-install pip -- but
it also produces command not found.
Use easy-install3 pip -- same problem: command not found.
Does PIP not install when you install Python 3.6?
Do I really have to edit the path myself - it seems to me, if necessary, the developers who created the installer would have done this and the path would have been updated when Python was installed.
Poking around the hidden system folders in OS X, I see that there is an alias called pip3.6 in usr/local/bin that was created a week ago when I installed Python 3.6.
I would try:
pip3.6 install whatever
Right, worked it out now.
Pip is installed when Python 3.6 is installed - but instead of typing "pip install", you type:
pip3.6 install <ModuleYouWant>
I guess this is so people can run Python 2.7 and 3.6 simultaneously.. it'd be nice if it were a little more intuitive though, or there were some instructions, or it just worked as pip gave you the option "2.7 or 3.6?"
For those OS X users in the dark like I was, please note that system files like the usr folder can be seen in Finder if you press Command+Shift+G then in the dialog box that pops up type /usr (There are other ways to see hidden folders too).

IPython3 for Mac OSX

I have Ipython installed but it runs on python 2.7.5 , I also have python 3.3 installed. How can I make changes such that Ipython runs on python 3.3 not 2.7.5?
You need to install pip for Python 3 - it's as easy as going to the pip-installer.org Installation page and following the instructions. Briefly, download get-pip.py and save it someplace, like your Downloads folder. Navigate there in Terminal, and run
sudo python3 get-pip.py
and you should soon have either a pip3 or pip-3.3 command (maybe both, I don't remember). You should now be able to run
sudo pip3 install ipython[all]
and hopefully all the dependencies will be installed as well. If installation chokes, use pip3 to install pyzmq, tornado, pyreadline, jinja2, pygments, and maybe a few others. Make sure you read the docs before you start, so you have an idea of what you're trying to achieve. IPython is large and quite complex, with many moving parts, so in the absence of a package manager (see below) it can take a bit of time before everything is up and running.
The Package Manager Way
There are other options, too. You can install Anaconda, a "Completely free enterprise-ready Python distribution for large-scale data processing, predictive analytics, and scientific computing" with over 100 packages, including IPython and its dependencies. By default, the Anaconda installer gives you Python 2.7, but you can use the conda command to install Python 3.
My personal favorite is to install Python 3 and IPython using MacPorts. Yes, it'll install Py3 all over again, but unless you're really starving for disk space (in which case you probably don't want to be installing large packages like IPython) it's no big deal. Using the port command, once the base MacPorts installation has been put in place, you can just run
sudo port install py33-ipython +pyqt4
and all the other dependencies will be taken care of, (hopefully) flawlessly, without your having to do anything else except wait for a long time while things like PyQt are compiled. You may also need to run sudo port install py33-ipython +notebook if you want the notebook, I don't recall if it's installed otherwise. BTW, you do need X11, Xcode, and the Xcode command-line tools for MacPorts, but they would likely be required if you do the first option as not all packages have binaries available for OS X. The excellent documentation walks you through everything, from installation to using the port command to maintaining your system. I would highly recommend modifying your ~/.profile (or ~/.bash_profile, ~/.bashrc, or equivalent for your shell) to add the MacPorts install directories (/opt/local/bin and /opt/local/sbin, by default) to the front of your path. Just add export PATH='/opt/local/bin:/opt/local/sbin:$PATH' to the end of the file.
A third alternative option is to use Homebrew. It's similar to MacPorts, in that the brew command is a type of package manager like port and conda, but in my experience it doesn't have as many packages, and doesn't quite work as seamlessly as port. However, my observations on StackOverflow, Ask Different and other fora seem to indicate that about 50% of people have great experiences with brew and don't like port, while the other half loves port over brew. YMMV.
I hope this helps. Good luck with your installation!

Resources