Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to create a new environment #1565

Closed
5thStreetBlues opened this issue Aug 27, 2016 · 20 comments
Closed

Unable to create a new environment #1565

5thStreetBlues opened this issue Aug 27, 2016 · 20 comments
Assignees
Labels
Milestone

Comments

@5thStreetBlues
Copy link

Problem: Unable to create a new environment via the "Custom" button in the Python Environments pane. The "Custom" button seems unresponsive.

Installed Python Environments The following three environments are installed on the local machine:

  • Python 3.4 installed C:\Python34
  • Python 3.5.2 (64 bit) installed in C:\Users\userName\AppData\Local\Programs\Python\Python35
  • Python 3.5.2 (32 bit) installed in C:\Users\userName\AppData\Local\Programs\Python\Python35-32

Windows Environment Information

  • OS 10.1.10586
  • Processor Intel Core i7-3770S
  • Path: contains C:\Users\userName\AppData\Local\Programs\Python\Python35; C:\Users\userName\AppData\Local\Programs\Python\Python35\Scripts\
  • PYTHONPATH is not defined
@zooba
Copy link
Member

zooba commented Aug 29, 2016

This typically means something in your Visual Studio installation has been corrupted. Can you try running a Repair install? (Open Programs and Features, find "Microsoft Visual Studio 2015" and choose Change, then select Repair)

@5thStreetBlues
Copy link
Author

Hi Steve,

I tried to repair Visual Studio. I also attempted to uninstall every possible MS Visual Studio associated program. Interesting enough a few could not be uninstalled.

Is there a utility to completely uninstall Visual Studio?

Thanks,
Norm

Sent from my iPad

On Aug 29, 2016, at 12:39 PM, Steve Dower notifications@github.com wrote:

This typically means something in your Visual Studio installation has been corrupted. Can you try running a Repair install? (Open Programs and Features, find "Microsoft Visual Studio 2015" and choose Change, then select Repair)


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.

@zooba
Copy link
Member

zooba commented Sep 1, 2016

Is there a utility to completely uninstall Visual Studio

I'm afraid not, but it's a goal for the next version. You shouldn't have to uninstall it to do a repair though.

@5thStreetBlues
Copy link
Author

Agreed.

However the repair did not solve the problem. The result is with no environment PTVS Is unusable.

Sent from my iPhone

On Sep 1, 2016, at 1:22 PM, Steve Dower notifications@github.com wrote:

Is there a utility to completely uninstall Visual Studio

I'm afraid not, but it's a goal for the next version. You shouldn't have to uninstall it to do a repair though.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.

@5thStreetBlues
Copy link
Author

I was successful in resolving this problem via the following by:

  1. Uninstalling Python Tools For Visual Studio
  2. Renaming the directory that contained the PTVS_2_2_4_VS_2015.msi file from PythonToolsForVisualStudioV6 to PythonToolsForVisualStudioV6_old. In retrospect I don't think this step was required.
  3. Downloaded and installed PythonToolsForVisualStudio from GitHub (link)

@JJMontreux
Copy link

JJMontreux commented Sep 7, 2016

Same problem here. In my case it happened after selecting the path to the Python interpreter 3.6.0a4 (64 bit). Visual Studio crashed and since then PTVS was disabled. I tried to repair and uninstall Visual Studio 2015 several times. I also tried to remove the registry keys associated with VS, and even automate this operation, the problem is not solved. It took more than a week testing solutions and is impossible to repair PTVS. Why is it so difficult to make an 'clean' uninstaller for this extension?

@5thStreetBlues
Copy link
Author

My problems also began when I installed Python 3.6. Perhaps this is somehow related to the root cause.

@zooba
Copy link
Member

zooba commented Sep 12, 2016

Earlier versions of PTVS don't always handle new versions of Python well (as in, we throw an exception when parsing the version number, and don't always catch it :( ), so it's entirely possible that Python 3.6 is the problem.

I don't think it's an issue in the latest release (2.2.5), but please shout out if it is.

(You don't need to uninstall/delete anything before upgrading using the installer from GitHub.)

@CountBigBang
Copy link

Python 3.6 seems to be a likely cause because I experienced similar problems ater installing the stable 3.6 release today on VS 2015 Enterprise (Update 3) with PTVS 2.2.5. The new environment wasn't detected so I tried to add a custom one. VS crashed, and after that all existing environments are gone and I am unable to add custom ones now. I already unstalled all Python versions, then reinstalled the 3.5 versions, cleaned the registry, deleted the Python Tools directory in the local AppData folder, reinstalled PTVS (2.2.5) and repaired VS. Unfortunately, the problem still persists. I would be very thankful for any hint on how to repair.

Unfortunately, I found this thread only after the damage was done :-(

@cliclpt
Copy link

cliclpt commented Dec 27, 2016

Encountered the same issue here - the Customize button grayed out after installing python 3.6 and since have not been able to make any change to the environment even after removing python 3.6 and reinstalling 3.4. Anyone here to rescue perhaps?

@zooba
Copy link
Member

zooba commented Dec 27, 2016

Python 3.6 isn't supported by PTVS 2.2.5 (since it didn't exist when we released it), but you should be able to add it as a custom environment and call it 3.5. There's a separate bug because auto-detect doesn't work (#1994), so you'll have to fill in the paths manually.

If you've already run into trouble, you can try deleting your %LocalAppData%\Microsoft\VisualStudio\14.0\ComponentModelCache directory and restarting VS. That should re-enable the custom environment support.

@cliclpt
Copy link

cliclpt commented Dec 27, 2016

Thanks but by deleting the ComponentModelCache folder did not seem to solve the issue. The custom environment support is still disabled although I have also tried to reinstall VS as well.

@zooba
Copy link
Member

zooba commented Dec 28, 2016

Can you try uninstalling Python Tools for Visual Studio from Programs and Features, then installing the one downloaded from https://github.com/Microsoft/PTVS/releases/tag/v2.2.5post1

@tobigithub
Copy link

tobigithub commented Dec 30, 2016

Same problem here, the custom button under Python environments in the Visual Studio Community Edition 2015 is not responsive, basically the solution Ctlr+K or Open the Python Environments window (View -> Other Windows -> Python Environments) and click "+ Custom...": does not work, VC++ and other compilers work.

What I did before, was to add and autofind my python 3.4 64 bit edition.
Visual Studio crashed and then the custom button was unresponsive.

  1. removed and reinstalled PTVS 2.2.5 - still not working
  2. Installed pyton 3.4 (32 bit for WINDOWS) - still not working
  3. Repair install of VS2015 - still not working

Now I have 3 python versions installed (2.7, 3.4, 3.6 in 32 and 64 bit) and still the python integration
in VC is not working (it worked with the ancient 2.7). No python path or environment variable for python set.

@tobigithub
Copy link

Solution for VS 2015 Community
delete: registry subfolders that contain the pyhton 3.6 references (GUIID folder)

HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\14.0\PythonTools\Interpreters

Source: #1994
Also only VS Community 2017 will support python 3.6

@steelyeyed
Copy link

Deleting the registry key fixed my issue. all appears to be back to normal. Thanks.. LG

@zooba zooba added this to the 2.2.6 milestone Jan 2, 2017
@zooba zooba self-assigned this Jan 3, 2017
zooba added a commit to zooba/PTVS that referenced this issue Jan 3, 2017
…hes with Python 3.6 64-bit

Improves handling when loading invalid version numbers from the registry
Prevents unsupported version numbers being auto-detected when configuring an environment.
zooba added a commit that referenced this issue Jan 3, 2017
Fixes #1565, #1994, #2005 Auto-detect crashes with Python 3.6 64-bit
@zooba zooba closed this as completed Jan 3, 2017
@zooba
Copy link
Member

zooba commented Jan 4, 2017

There is a 2.2.6 RC release at https://github.com/Microsoft/PTVS/releases/tag/v2.2.6-rc with the fix for this issue. Please try it out and let us know if anything goes horribly wrong - we want to push the fix to all users within the next month.

@tobigithub
Copy link

tobigithub commented Jan 5, 2017

The 2.2.6 RC works fine on Win7 and VC2015 community. There is an interesting twist.
The coding environment is now Python 2.7

print("hello")
print(22/7)

hello
3
The thread 'MainThread' (0x790) has exited with code 0 (0x0).
The program '[13668] python.exe' has exited with code 0 (0x0).

and the interactive environment (Ctrl-K) is python 3.4 64-bit,

>>> 
>>> print("hello")
hello
>>> print(22/7)
3.142857142857143
>>> 

Upon switching to Python interactive 2.7 it will print

hello
3.142857142857143
Press any key to continue . . .

That is not possible. It should print "3", because changes in python.

So I guess VC2015 does not crash anymore, or blocks out with grey buttons, but there is still some
issue in selecting the correct environment. This is with 3-6 different python versions installed (including (2.7, 3.4, 3.6 in 32 and 64 bit).


Upon restart of VC2015 it will bring out an error window
"the PTP did not load correctly"
The cause is a change in envoronments and activitylog.xml

and then VC shows

An exception was encountered while constructing the content of this frame.  This information is also logged in "C:\Users\XXX\AppData\Roaming\Microsoft\VisualStudio\14.0\ActivityLog.xml".

Exception details:
System.Exception: Exception of type 'System.Exception' was thrown.
   at Microsoft.VisualStudio.Shell.Interop.IVsShell5.LoadPackageWithContext(Guid& packageGuid, Int32 reason, Guid& context)
   at Microsoft.VisualStudio.Platform.WindowManagement.WindowFrame.GetPackage()
   at Microsoft.VisualStudio.Platform.WindowManagement.WindowFrame.ConstructContent()

then

VC2015 component cache is out of date, please restart

Then

scanning new MEF

and then worse errors appear, upon loading standard (not related) VC++ projects,
this worked before and VC++ projects were not affected.

The mappings for the solution could not be found.
The active solution has been temporarily disconnected from source control because the server is unavailable.  To attempt to reconnect to source control, close and then re-open the solution when the server is available.  If you want to connect this solution to another server, use the Change Source Control dialog.

After a couple of restarts it kinda works. One can switch between Python 3.4 and 2.7.

@zooba
Copy link
Member

zooba commented Jan 5, 2017

@tobigithub Thanks for the info. The component model cache problem is a VS bug that won't be fixed, but restarting VS should resolve it (as the message suggests).

If you previously had a custom environment set up for 3.6 that was breaking VS, we probably automatically changed the version to 2.7 (which is the default version everywhere throughout that version of PTVS). That shouldn't affect anything except syntax errors in the editor, but possibly some saved selections are now confused about which environment to use (for example, something is looking for "2.7" and having to choose between two different 2.7's, whereas before there was only one).

Editing the custom environment and selecting "3.5" as the version should get you as close as is possible. Unfortunately, the places in code where we default to 2.7 are not suitable for deeper inspection (we can't run python.exe and ask it, for example), so when we encounter an invalid version number choosing the default is the only realistic option.

@tobigithub
Copy link

@zooba Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants